Xceed Chart for WinForms can render in a .NET bitmap, which allows you to implement image export capabilities in your Windows Forms or ASP.NET (WebForms) application.
RenderToBitmap
This function accepts a .NET Bitmap object, to which the chart will render. The following code will generate a .png file from the chart currently displayed by the control:
VB.NET | |
---|---|
|
C# | |
---|---|
Bitmap bitmap = new Bitmap(200, 200, PixelFormat.Format24bppRgb); |
The control will automatically render with the proper dimensions (synchronized with the dimensions of the passed bitmap).
RenderToBitmapGrayScale
This is similar to RenderToBitmap except that the generated image will be grayscaled. The control uses this function internally when printing in grayscale mode.
VB.NET | |
---|---|
|
C# | |
---|---|
Bitmap bitmap = new Bitmap(200, 200, PixelFormat.Format24bppRgb); |
RenderToHBitmap
This function generates a handle to a Windows GDI bitmap and can come in very handy in legacy applications that use the chart control via COM interop.
VB.NET | |
---|---|
|
C# | |
---|---|
int bitmapHandle = 0; |
Note that if you're using the chart via interop, you must delete the returned handle by calling DeleteObject on it.