Chart for .NET / User's Guide / Image Export / Rendering to Bitmap

In This Topic
    Rendering to Bitmap
    In This Topic

    Nevron Chart for .NET can render in a .NET bitmap which allows you to implement image export capabilities in your WinForms or WebForms application.

     RenderToBitmap

    This function accepts a .NET Bitmap object where the chart will render to. The following code will generate a .png file from the current chart displayed by the control:

    C#
    Copy Code
    Bitmap bitmap = new Bitmap(200, 200, PixelFormat.Format24bppRgb);
    chartControl.ImageExporter.RenderToBitmap(bitmap, false);
    bitmap.Save("c:\\temp\\chartimage.png", ImageFormat.Png);
    
    Visual Basic
    Copy Code
    Dim bitmap  As Bitmap = New Bitmap(200, 200, PixelFormat.Format24bppRgb)
    chartControl.ImageExporter.RenderToBitmap(bitmap, False)
    bitmap.Save("c:\temp\chartimage.png", ImageFormat.Png)
    

    The control will automatically render with proper dimensions (synchronized with the dimensions of the passed bitmap). When you pass true to the second parameter the control will render a grayscale image.

    See Also