ToolRectangle.cs
上传用户:sxsgcs
上传日期:2013-10-21
资源大小:110k
文件大小:1k
- using System;
- using System.Windows.Forms;
- using System.Drawing;
- namespace DrawTools
- {
- /// <summary>
- /// Rectangle tool
- /// </summary>
- class ToolRectangle : DrawTools.ToolObject
- {
- public ToolRectangle()
- {
- Cursor = new Cursor(GetType(), "Rectangle.cur");
- }
- public override void OnMouseDown(DrawArea drawArea, MouseEventArgs e)
- {
- AddNewObject(drawArea, new DrawRectangle(e.X, e.Y, 1, 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, 5);
- drawArea.Refresh();
- }
- }
- }
- }