Changeset 1058 for trunk/sources/HeuristicLab.Visualization
- Timestamp:
- 12/23/08 15:44:47 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Visualization
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization/LineChart.Designer.cs
r1038 r1058 1 namespace HeuristicLab.Visualization 1 using System.Windows.Forms; 2 3 namespace HeuristicLab.Visualization 2 4 { 3 5 partial class LineChart … … 42 44 this.canvas.Text = "canvas"; 43 45 this.canvas.MouseDown += new System.Windows.Forms.MouseEventHandler(this.canvasUI1_MouseDown); 46 this.canvas.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.canvasUI1_MouseWheel); 44 47 // 45 48 // LineChart -
trunk/sources/HeuristicLab.Visualization/LineChart.cs
r1049 r1058 63 63 root.AddShape(linesShape); 64 64 65 legendShape = new LegendShape(0, 0,0,0,0,Color.Black);65 legendShape = new LegendShape(0, 0, 0, 0, 0, Color.Black); 66 66 //legendShape.AddLegendItem(new LegendItem("test", Color.Red, 5)); 67 67 //legendShape.AddLegendItem(new LegendItem("test1", Color.Blue, 5)); … … 74 74 titleShape = new TextShape(0, 0, "Title", 15); 75 75 root.AddShape(titleShape); 76 77 76 78 77 … … 277 276 278 277 private void canvasUI1_MouseDown(object sender, MouseEventArgs e) { 278 Focus(); 279 279 280 if (ModifierKeys == Keys.Control) { 280 281 CreateZoomListener(e); … … 284 285 } 285 286 287 private void canvasUI1_MouseWheel(object sender, MouseEventArgs e) { 288 if (ModifierKeys == Keys.Control) { 289 double zoomFactor = (e.Delta > 0) ? 0.9 : 1.1; 290 291 RectangleD clippingArea = ZoomListener.ZoomClippingArea(linesShape.ClippingArea, zoomFactor); 292 293 SetLineClippingArea(clippingArea); 294 canvas.Invalidate(); 295 } 296 } 297 286 298 private void CreateZoomListener(MouseEventArgs e) { 287 299 ZoomListener zoomListener = new ZoomListener(e.Location); -
trunk/sources/HeuristicLab.Visualization/ZoomListener.cs
r1055 r1058 53 53 54 54 #endregion 55 56 public static RectangleD ZoomClippingArea(RectangleD clippingArea, double zoomFactor) { 57 double x1, x2, y1, y2, width, height; 58 59 width = clippingArea.Width * zoomFactor; 60 height = clippingArea.Height * zoomFactor; 61 62 x1 = clippingArea.X1 - (width - clippingArea.Width) / 2; 63 y1 = clippingArea.Y1 - (height - clippingArea.Height) / 2; 64 x2 = width + x1; 65 y2 = height + y1; 66 67 return new RectangleD(x1, y1, x2, y2); 68 } 55 69 } 56 70 }
Note: See TracChangeset
for help on using the changeset viewer.