Draw Graph to a Bitmap

Feb 20, 2009 at 6:10 PM

I'm using the class libraries.  I've created a graph and want to draw it to a bitmap to save.  In the .66 release GraphDrawer had a Draw() method that returned a Bitmap.  It no longer does and I cannot find any other references to Bitmaps.  How can I get this functionality back?

Feb 25, 2009 at 2:52 PM

Sorry for the delay.  I was out of office for a  few days.

Although I put such a method in the new Wpf.NodeXLControl class, I didn't think it belonged in the lower-level GraphDrawer class.  However, the utility method WpfGraphicsUtility.VisualToBitmap() should be available in the Microsoft.NodeXL.Visualization.Wpf.dll assembly, so just use that method.  The source code for it is available here if you want to write your own version:


-- Tony
Feb 25, 2009 at 4:12 PM

On second thought, VisualToBitmap() accepts a Visual object, and GraphDrawer isn't a Visual.  You might consider using NodeXLVisual instead of GraphDrawer in your application.  Please see the NodeXLVisual topic in the NodeXLApi.chm help file for details.

-- Tony