Last change
on this file since 16462 was
4068,
checked in by swagner, 14 years ago
|
Sorted usings and removed unused usings in entire solution (#1094)
|
File size:
1.8 KB
|
Line | |
---|
1 | using System.Drawing;
|
---|
2 |
|
---|
3 | namespace Netron.Diagramming.Core {
|
---|
4 | /// <summary>
|
---|
5 | /// Tool to draw complex rectangles on the canvas
|
---|
6 | /// </summary>
|
---|
7 | public class ComplexRectangleTool : AbstractDrawingTool {
|
---|
8 | #region Fields
|
---|
9 |
|
---|
10 | #endregion
|
---|
11 |
|
---|
12 | #region Properties
|
---|
13 |
|
---|
14 | #endregion
|
---|
15 |
|
---|
16 | #region Constructor
|
---|
17 | public ComplexRectangleTool()
|
---|
18 | : base("ComplexRectangle Tool") {
|
---|
19 | }
|
---|
20 | public ComplexRectangleTool(string name)
|
---|
21 | : base(name) {
|
---|
22 |
|
---|
23 | }
|
---|
24 | #endregion
|
---|
25 |
|
---|
26 | #region Methods
|
---|
27 | protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e) {
|
---|
28 | base.OnMouseMove(e);
|
---|
29 | if (IsActive && started) {
|
---|
30 | Point point = new Point(e.X, e.Y);
|
---|
31 |
|
---|
32 | Controller.View.PaintGhostRectangle(startingPoint, point);
|
---|
33 |
|
---|
34 | Controller.View.Invalidate(System.Drawing.Rectangle.Inflate(Controller.View.Ghost.Rectangle, 20, 20));
|
---|
35 | }
|
---|
36 | }
|
---|
37 |
|
---|
38 |
|
---|
39 | /// <summary>
|
---|
40 | /// This method will be called when the user has finished drawing a ghost rectangle or bundle
|
---|
41 | /// and initiates the actual creation of a bundle and the addition to the model via the appropriate command.
|
---|
42 | /// </summary>
|
---|
43 | protected override void GhostDrawingComplete() {
|
---|
44 |
|
---|
45 | try {
|
---|
46 | ComplexRectangle shape = new ComplexRectangle(this.Controller.Model);
|
---|
47 | shape.Width = (int)Rectangle.Width;
|
---|
48 | shape.Height = (int)Rectangle.Height;
|
---|
49 | AddShapeCommand cmd = new AddShapeCommand(this.Controller, shape, new Point((int)Rectangle.X, (int)Rectangle.Y));
|
---|
50 | this.Controller.UndoManager.AddUndoCommand(cmd);
|
---|
51 | cmd.Redo();
|
---|
52 | }
|
---|
53 | catch {
|
---|
54 | base.Controller.DeactivateTool(this);
|
---|
55 | Controller.View.Invalidate();
|
---|
56 | throw;
|
---|
57 | }
|
---|
58 |
|
---|
59 | //base.Controller.DeactivateTool(this);
|
---|
60 | }
|
---|
61 |
|
---|
62 |
|
---|
63 | #endregion
|
---|
64 | }
|
---|
65 |
|
---|
66 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.