Changeset 9415
- Timestamp:
- 05/02/13 10:45:44 (12 years ago)
- Location:
- branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/ChartControl.Designer.cs
r4776 r9415 58 58 this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); 59 59 this.propertiesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 60 this.saveImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 60 61 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 62 this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); 61 63 ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); 62 64 this.pictureBoxContextMenuStrip.SuspendLayout(); … … 65 67 // pictureBox 66 68 // 67 this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 68 | System.Windows.Forms.AnchorStyles.Left)69 69 this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 70 | System.Windows.Forms.AnchorStyles.Left) 71 | System.Windows.Forms.AnchorStyles.Right))); 70 72 this.pictureBox.BackColor = System.Drawing.Color.White; 71 73 this.pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; … … 76 78 this.pictureBox.TabIndex = 0; 77 79 this.pictureBox.TabStop = false; 80 this.pictureBox.SizeChanged += new System.EventHandler(this.pictureBox_SizeChanged); 78 81 this.pictureBox.VisibleChanged += new System.EventHandler(this.pictureBox_VisibleChanged); 79 82 this.pictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseDown); 80 83 this.pictureBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseMove); 81 84 this.pictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseUp); 82 this.pictureBox.SizeChanged += new System.EventHandler(this.pictureBox_SizeChanged);83 85 // 84 86 // pictureBoxContextMenuStrip … … 94 96 this.intoBackgroundToolStripMenuItem, 95 97 this.toolStripMenuItem2, 96 this.propertiesToolStripMenuItem}); 98 this.propertiesToolStripMenuItem, 99 this.saveImageToolStripMenuItem}); 97 100 this.pictureBoxContextMenuStrip.Name = "pictureBoxContextMenuStrip"; 98 this.pictureBoxContextMenuStrip.Size = new System.Drawing.Size(16 5, 192);101 this.pictureBoxContextMenuStrip.Size = new System.Drawing.Size(163, 214); 99 102 // 100 103 // moveToolStripMenuItem … … 103 106 this.moveToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; 104 107 this.moveToolStripMenuItem.Name = "moveToolStripMenuItem"; 105 this.moveToolStripMenuItem.Size = new System.Drawing.Size(16 4, 22);108 this.moveToolStripMenuItem.Size = new System.Drawing.Size(162, 22); 106 109 this.moveToolStripMenuItem.Text = "&Move"; 107 110 this.moveToolStripMenuItem.Click += new System.EventHandler(this.moveToolStripMenuItem_Click); … … 110 113 // 111 114 this.zoomToolStripMenuItem.Name = "zoomToolStripMenuItem"; 112 this.zoomToolStripMenuItem.Size = new System.Drawing.Size(16 4, 22);115 this.zoomToolStripMenuItem.Size = new System.Drawing.Size(162, 22); 113 116 this.zoomToolStripMenuItem.Text = "&Zoom"; 114 117 this.zoomToolStripMenuItem.Click += new System.EventHandler(this.zoomToolStripMenuItem_Click); … … 117 120 // 118 121 this.selectToolStripMenuItem.Name = "selectToolStripMenuItem"; 119 this.selectToolStripMenuItem.Size = new System.Drawing.Size(16 4, 22);122 this.selectToolStripMenuItem.Size = new System.Drawing.Size(162, 22); 120 123 this.selectToolStripMenuItem.Text = "&Select"; 121 124 this.selectToolStripMenuItem.Click += new System.EventHandler(this.selectToolStripMenuItem_Click); … … 124 127 // 125 128 this.toolStripMenuItem1.Name = "toolStripMenuItem1"; 126 this.toolStripMenuItem1.Size = new System.Drawing.Size(1 61, 6);129 this.toolStripMenuItem1.Size = new System.Drawing.Size(159, 6); 127 130 // 128 131 // oneLayerUpToolStripMenuItem … … 130 133 this.oneLayerUpToolStripMenuItem.Enabled = false; 131 134 this.oneLayerUpToolStripMenuItem.Name = "oneLayerUpToolStripMenuItem"; 132 this.oneLayerUpToolStripMenuItem.Size = new System.Drawing.Size(16 4, 22);135 this.oneLayerUpToolStripMenuItem.Size = new System.Drawing.Size(162, 22); 133 136 this.oneLayerUpToolStripMenuItem.Text = "One Layer &Up"; 134 137 this.oneLayerUpToolStripMenuItem.Click += new System.EventHandler(this.oneLayerUpToolStripMenuItem_Click); … … 138 141 this.oneLayerDownToolStripMenuItem.Enabled = false; 139 142 this.oneLayerDownToolStripMenuItem.Name = "oneLayerDownToolStripMenuItem"; 140 this.oneLayerDownToolStripMenuItem.Size = new System.Drawing.Size(16 4, 22);143 this.oneLayerDownToolStripMenuItem.Size = new System.Drawing.Size(162, 22); 141 144 this.oneLayerDownToolStripMenuItem.Text = "OneLayer &Down"; 142 145 this.oneLayerDownToolStripMenuItem.Click += new System.EventHandler(this.oneLayerDownToolStripMenuItem_Click); … … 146 149 this.intoForegroundToolStripMenuItem.Enabled = false; 147 150 this.intoForegroundToolStripMenuItem.Name = "intoForegroundToolStripMenuItem"; 148 this.intoForegroundToolStripMenuItem.Size = new System.Drawing.Size(16 4, 22);151 this.intoForegroundToolStripMenuItem.Size = new System.Drawing.Size(162, 22); 149 152 this.intoForegroundToolStripMenuItem.Text = "Into &Foreground"; 150 153 this.intoForegroundToolStripMenuItem.Click += new System.EventHandler(this.intoForegroundToolStripMenuItem_Click); … … 154 157 this.intoBackgroundToolStripMenuItem.Enabled = false; 155 158 this.intoBackgroundToolStripMenuItem.Name = "intoBackgroundToolStripMenuItem"; 156 this.intoBackgroundToolStripMenuItem.Size = new System.Drawing.Size(16 4, 22);159 this.intoBackgroundToolStripMenuItem.Size = new System.Drawing.Size(162, 22); 157 160 this.intoBackgroundToolStripMenuItem.Text = "Into &Background"; 158 161 this.intoBackgroundToolStripMenuItem.Click += new System.EventHandler(this.intoBackgroundToolStripMenuItem_Click); … … 161 164 // 162 165 this.toolStripMenuItem2.Name = "toolStripMenuItem2"; 163 this.toolStripMenuItem2.Size = new System.Drawing.Size(1 61, 6);166 this.toolStripMenuItem2.Size = new System.Drawing.Size(159, 6); 164 167 // 165 168 // propertiesToolStripMenuItem … … 167 170 this.propertiesToolStripMenuItem.Enabled = false; 168 171 this.propertiesToolStripMenuItem.Name = "propertiesToolStripMenuItem"; 169 this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(16 4, 22);172 this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(162, 22); 170 173 this.propertiesToolStripMenuItem.Text = "&Properties"; 171 174 this.propertiesToolStripMenuItem.Click += new System.EventHandler(this.propertiesToolStripMenuItem_Click); 175 // 176 // saveImageToolStripMenuItem 177 // 178 this.saveImageToolStripMenuItem.Name = "saveImageToolStripMenuItem"; 179 this.saveImageToolStripMenuItem.Size = new System.Drawing.Size(162, 22); 180 this.saveImageToolStripMenuItem.Text = "Save Image"; 181 this.saveImageToolStripMenuItem.Click += new System.EventHandler(this.saveImageToolStripMenuItem_Click); 182 // 183 // saveFileDialog 184 // 185 this.saveFileDialog.DefaultExt = "emf"; 186 this.saveFileDialog.FileName = "*.emf"; 187 this.saveFileDialog.Filter = "Enhanced metafile|*.emf|Bitmap files|*.bmp"; 172 188 // 173 189 // ChartControl … … 201 217 protected System.Windows.Forms.ToolStripMenuItem intoBackgroundToolStripMenuItem; 202 218 protected System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; 219 private System.Windows.Forms.ToolStripMenuItem saveImageToolStripMenuItem; 220 private System.Windows.Forms.SaveFileDialog saveFileDialog; 203 221 204 222 } -
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/ChartControl.cs
r7780 r9415 24 24 using System.Drawing; 25 25 using System.Drawing.Drawing2D; 26 using System.Drawing.Imaging; 26 27 using System.Windows.Forms; 27 28 … … 29 30 public partial class ChartControl : UserControl { 30 31 private Bitmap bitmap; 32 public Bitmap Bitmap { get; private set; } 31 33 private bool renderingRequired; 32 34 private Point buttonDownPoint; … … 135 137 } 136 138 137 pr ivatevoid pictureBox_MouseMove(object sender, MouseEventArgs e) {139 protected virtual void pictureBox_MouseMove(object sender, MouseEventArgs e) { 138 140 var text = Chart.GetToolTipText(e.Location); 139 141 if (toolTip.GetToolTip(pictureBox) != text) … … 244 246 Chart.Mode = mode; 245 247 } 248 249 private void SaveImageAsBitmap(string filename) { 250 if (bitmap == null) throw new Exception("Bitmap is null."); 251 bitmap.Save(filename); 252 } 253 254 private void SaveImageAsEmf(string filename) { 255 using (Graphics g = CreateGraphics()) { 256 using (Metafile file = new Metafile(filename, g.GetHdc())) { 257 using (Graphics emfFile = Graphics.FromImage(file)) { 258 Chart.Render(emfFile, pictureBox.Width, pictureBox.Height); 259 } 260 } 261 g.ReleaseHdc(); 262 } 263 } 264 265 private void saveImageToolStripMenuItem_Click(object sender, EventArgs e) { 266 if (saveFileDialog.ShowDialog() == DialogResult.OK) { 267 string filename = saveFileDialog.FileName.ToLower(); 268 if (filename.EndsWith("bmp")) SaveImageAsBitmap(filename); 269 else if (filename.EndsWith("emf")) SaveImageAsEmf(filename); 270 else SaveImageAsBitmap(filename); 271 } 272 } 246 273 } 247 274 } -
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/Group.cs
r8219 r9415 117 117 foreach (var primitive in myPrimitives.Where(primitive => primitive.ContainsPoint(point))) { 118 118 primitives.Add(primitive); 119 var @group = primitive as IGroup;120 if ( @group != null)121 primitives.AddRange( (@group).Primitives);119 var group = primitive as IGroup; 120 if (group != null) 121 primitives.AddRange(group.Primitives); 122 122 } 123 123 return primitives; -
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/Primitives/LinearPrimitiveBase.cs
r4776 r9415 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Text;25 22 using System.Drawing; 26 23 using System.Drawing.Drawing2D;
Note: See TracChangeset
for help on using the changeset viewer.