Clipboard support is an essential part of any Windows component. Xceed Chart for WinForms can place bitmap images in the clipboard with ease. This is achieved with the help of the CopyToClipboard function of the ImageExport object. The function has two versions:
VB.NET |
|
Public Sub CopyToClipboard(ByVal pixelFormat As PixelFormat, ByVal grayscale As Boolean) Public Sub CopyToClipboard(ByVal dimensions As Size, ByVal pixelFormat As PixelFormat, ByVal grayscale As Boolean)
|
C# |
|
public void CopyToClipboard(PixelFormat pixelFormat, bool grayscale)
public void CopyToClipboard(Size dimensions, PixelFormat pixelFormat, bool grayscale)
|
The first version exports a bitmap with the dimensions of the control in the form, whereas the second one uses the dimensions passed through the dimensions parameter. The pixelFormat defines the PixelFormat of the generated bitmap. When you pass "true" to the grayscale parameters, the generated image will be grayscaled. This can be very useful if you have to print the image on black and white printers.
The following code will place a 400x400 true-color bitmap image of the chart in the clipboard:
VB.NET |
|
chartControl.ImageExport.CopyToClipboard(New Size(400, 400), PixelFormat.Format32bppRgb, False)
|
C# |
|
chartControl.ImageExport.CopyToClipboard(new Size(400, 400), PixelFormat.Format32bppRgb, false);
|
See also
ChartControl