Changeset 725 for trunk/sources/HeuristicLab.Visualization.Test/MainForm.cs
- Timestamp:
- 11/09/08 16:30:24 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization.Test/MainForm.cs
r636 r725 1 1 using System.Drawing; 2 2 using System.Windows.Forms; 3 using HeuristicLab.Visualization;4 3 5 4 namespace HeuristicLab.Visualization.Test { 6 5 public partial class MainForm : Form { 6 private MouseEventListener dragDropListener; 7 7 8 public MainForm() { 8 9 InitializeComponent(); 10 11 CreateMouseEventListeners(); 9 12 10 13 canvasUI.MainCanvas.WorldShape = new WorldShape(new RectangleD(0, 0, 800, 600), new RectangleD(0, 0, 800, 600)); … … 16 19 17 20 canvasUI.Invalidate(); 21 } 22 23 private void CreateMouseEventListeners() { 24 dragDropListener = new MouseEventListener(); 25 dragDropListener.OnMouseMove += DragDrop_OnMouseMove; 26 dragDropListener.OnMouseUp += DragDrop_OnMouseUp; 18 27 } 19 28 … … 34 43 35 44 for (int i = 0; i < 10000; i++) { 36 RectangleShape rect = new RectangleShape(x1, y1, x1+0.3, y1+0.3, 0, Color.Maroon); 37 x1 += 0.4; y1 += 0.4; 45 RectangleShape rect = new RectangleShape(x1, y1, x1 + 0.3, y1 + 0.3, 0, Color.Maroon); 46 x1 += 0.4; 47 y1 += 0.4; 38 48 rightWorld.AddShape(rect); 39 49 } … … 81 91 mainWorld.AddShape(leftWorld); 82 92 } 93 94 private void canvasUI_MouseDown(object sender, MouseEventArgs e) { 95 mouseEventDemonstrationGraphics = canvasUI.CreateGraphics(); 96 97 dragDropListener.StartPoint = e.Location; 98 lastActualPoint = e.Location; 99 100 canvasUI.MouseEventListener = dragDropListener; 101 } 102 103 private Point lastActualPoint; 104 private Graphics mouseEventDemonstrationGraphics; 105 106 private void DragDrop_OnMouseUp(Point startPoint, Point actualPoint) { 107 canvasUI.MouseEventListener = null; 108 109 canvasUI.Invalidate(); 110 mouseEventDemonstrationGraphics.Dispose(); 111 } 112 113 private void DragDrop_OnMouseMove(Point startPoint, Point actualPoint) { 114 mouseEventDemonstrationGraphics.DrawLine(Pens.Blue, lastActualPoint, actualPoint); 115 lastActualPoint = actualPoint; 116 } 83 117 } 84 118 }
Note: See TracChangeset
for help on using the changeset viewer.