CraftSynth.ImageEditor – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | using System.Drawing; |
2 | using System.Windows.Forms; |
||
3 | |||
4 | namespace CraftSynth.ImageEditor |
||
5 | { |
||
6 | /// <summary> |
||
7 | /// Line tool |
||
8 | /// </summary> |
||
9 | internal class ToolLine : ToolObject |
||
10 | { |
||
11 | public ToolLine() |
||
12 | { |
||
13 | Cursor = new Cursor(GetType(), "Line.cur"); |
||
14 | } |
||
15 | |||
16 | public override void OnMouseDown(DrawArea drawArea, MouseEventArgs e) |
||
17 | { |
||
18 | Point p = drawArea.BackTrackMouse(new Point(e.X, e.Y)); |
||
19 | AddNewObject(drawArea, new DrawLine(p.X, p.Y, p.X + 1, p.Y + 1, drawArea.LineColor, drawArea.LineWidth, drawArea.PenType, drawArea.EndCap)); |
||
20 | } |
||
21 | |||
22 | public override void OnMouseMove(DrawArea drawArea, MouseEventArgs e) |
||
23 | { |
||
24 | drawArea.Cursor = Cursor; |
||
25 | |||
26 | if (e.Button == |
||
27 | MouseButtons.Left) |
||
28 | { |
||
29 | Point point = drawArea.BackTrackMouse(new Point(e.X, e.Y)); |
||
30 | int al = drawArea.TheLayers.ActiveLayerIndex; |
||
31 | drawArea.TheLayers[al].Graphics[0].MoveHandleTo(point, 2); |
||
32 | drawArea.Refresh(); |
||
33 | } |
||
34 | } |
||
35 | } |
||
36 | } |