Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4142


Ignore:
Timestamp:
08/04/10 11:25:14 (14 years ago)
Author:
gkronber
Message:

Added export to file functionality for the DataTableView. #1127

Location:
trunk/sources/HeuristicLab.Analysis.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.Designer.cs

    r3703 r4142  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      this.components = new System.ComponentModel.Container();
    4748      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    4849      System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
    4950      System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
    5051      this.chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
     52      this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
     53      this.exportChartToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     54      this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
    5155      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5256      ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
     57      this.contextMenuStrip.SuspendLayout();
    5358      this.SuspendLayout();
    5459      //
     
    7681      chartArea1.Name = "ChartArea1";
    7782      this.chart.ChartAreas.Add(chartArea1);
     83      this.chart.ContextMenuStrip = this.contextMenuStrip;
    7884      legend1.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;
    7985      legend1.Name = "Legend1";
     
    8894      this.chart.TabIndex = 4;
    8995      this.chart.Text = "chart1";
     96      this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend);
     97      this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown);
    9098      this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove);
    91       this.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart_MouseDown);
    92       this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend);
     99      //
     100      // contextMenuStrip
     101      //
     102      this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     103            this.exportChartToolStripMenuItem});
     104      this.contextMenuStrip.Name = "contextMenuStrip";
     105      this.contextMenuStrip.Size = new System.Drawing.Size(153, 48);
     106      //
     107      // exportChartToolStripMenuItem
     108      //
     109      this.exportChartToolStripMenuItem.Name = "exportChartToolStripMenuItem";
     110      this.exportChartToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
     111      this.exportChartToolStripMenuItem.Text = "Export chart...";
     112      this.exportChartToolStripMenuItem.Click += new System.EventHandler(this.exportChartToolStripMenuItem_Click);
     113      //
     114      // saveFileDialog
     115      //
     116      this.saveFileDialog.DefaultExt = "emf";
     117      this.saveFileDialog.Filter = "EMF Files|*.emf";
    93118      //
    94119      // DataTableView
     
    106131      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    107132      ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit();
     133      this.contextMenuStrip.ResumeLayout(false);
    108134      this.ResumeLayout(false);
    109135      this.PerformLayout();
     
    114140
    115141    private System.Windows.Forms.DataVisualization.Charting.Chart chart;
     142    private System.Windows.Forms.ContextMenuStrip contextMenuStrip;
     143    private System.Windows.Forms.ToolStripMenuItem exportChartToolStripMenuItem;
     144    private System.Windows.Forms.SaveFileDialog saveFileDialog;
    116145
    117146  }
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.cs

    r4068 r4142  
    395395      return double.IsNaN(x) || x < (double)decimal.MinValue || x > (double)decimal.MaxValue;
    396396    }
     397
     398    private void exportChartToolStripMenuItem_Click(object sender, EventArgs e) {
     399      if (saveFileDialog.ShowDialog() == DialogResult.OK) {
     400        chart.SaveImage(saveFileDialog.FileName, ChartImageFormat.EmfDual);
     401      }
     402    }
    397403  }
    398404}
Note: See TracChangeset for help on using the changeset viewer.