Applies to: Nevron Chart for .NET

How to copy a chart image to the clipboard?

In many cases you need to export chart images directly to the clipboard, which can then be used by other programs (such as Microsoft Word or PowerPoint). The Nevron Chart control provides native support for doing this through two functions located in the Image exporter class.

The simplest way to export chart image to clipboard is by executing the following code:

[C#]
nChartControl1.ImageExporter.CopyToClipboard(new NBitmapImageFormat());

[VB.NET]
nChartControl1.ImageExporter.CopyToClipboard(New NBitmapImageFormat())

This line of code will copy to the clipboard the chart rendered in Bitmap format with the resolution of the current screen and with the size of the control in the form.

In cases when you need to export in different size or resolution you can use the second overload of the function – for example:

[C#]
nChartControl1.ImageExporter.CopyToClipboard(new NSize(600, 600), NResolution.ScreenResolution, new NBitmapImageFormat());

[VB.NET]
nChartControl1.ImageExporter.CopyToClipboard(New NSize(600, 600), NResolution.ScreenResolution, New NBitmapImageFormat())

will export a 600x600 image with screen resolution – 96dpi (default screen resolution).

You can also modify the resolution:

[C#]
nChartControl1.ImageExporter.CopyToClipboard(new NSize(1200, 1200), new NResolution(300, 300), new NBitmapImageFormat());

[VB.NET]
nChartControl1.ImageExporter.CopyToClipboard(New NSize(1200, 1200), New NResolution(300, 300), New NBitmapImageFormat())

which will result in a 1200x1200 image with 300dpi which is more suitable for printing.

Article ID: 56, Created On: 10/6/2010, Modified: 11/15/2010