Line | |
---|
1 | using System.Drawing;
|
---|
2 | using System.Drawing.Imaging;
|
---|
3 | using System.Windows.Forms;
|
---|
4 |
|
---|
5 | namespace HeuristicLab.Visualization.DataExport {
|
---|
6 | public class ImageDataExport : IExporter {
|
---|
7 | public string Name {
|
---|
8 | get { return "Image Export"; }
|
---|
9 | }
|
---|
10 |
|
---|
11 | public void Export(IChartDataRowsModel model, LineChart chart) {
|
---|
12 | SaveFileDialog sfd = new SaveFileDialog();
|
---|
13 | sfd.Filter = "Png Files|*.png|All Files|*.*";
|
---|
14 | if (sfd.ShowDialog() != DialogResult.OK) {
|
---|
15 | return;
|
---|
16 | }
|
---|
17 |
|
---|
18 | string filename = sfd.FileName;
|
---|
19 |
|
---|
20 | using (Bitmap bmp = chart.Snapshot()) {
|
---|
21 | bmp.Save(filename, ImageFormat.Png);
|
---|
22 | }
|
---|
23 | }
|
---|
24 | }
|
---|
25 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.