Free cookie consent management tool by TermsFeed Policy Generator

source: branches/Persistence Test/HeuristicLab.Visualization/3.2/DataExport/ImageDataExport.cs @ 4383

Last change on this file since 4383 was 1980, checked in by mstoeger, 16 years ago

Data Export (PNG) #588

File size: 662 bytes
Line 
1using System.Drawing;
2using System.Drawing.Imaging;
3using System.Windows.Forms;
4
5namespace 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.