ToolLine.cs
上传用户:sxsgcs
上传日期:2013-10-21
资源大小:110k
文件大小:1k
- using System;
- using System.Windows.Forms;
- using System.Drawing;
- namespace DrawTools
- {
- /// <summary>
- /// Line tool
- /// </summary>
- class ToolLine : DrawTools.ToolObject
- {
- public ToolLine()
- {
- Cursor = new Cursor(GetType(), "Line.cur");
- }
- public override void OnMouseDown(DrawArea drawArea, MouseEventArgs e)
- {
- AddNewObject(drawArea, new DrawLine(e.X, e.Y, e.X + 1, e.Y + 1));
- }
- public override void OnMouseMove(DrawArea drawArea, MouseEventArgs e)
- {
- drawArea.Cursor = Cursor;
- if ( e.Button == MouseButtons.Left )
- {
- Point point = new Point(e.X, e.Y);
- drawArea.GraphicsList[0].MoveHandleTo(point, 2);
- drawArea.Refresh();
- }
- }
- }
- }