123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Annotation.Label;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Windows.Forms;
- namespace PaintDotNet.Annotation.Other
- {
- /// <summary>
- /// 二值提取 - 交互操作 - 分割 - 直线
- /// </summary>
- public class DrawBinaryConnectionLine : DrawObject
- {
- public DrawBinaryConnectionLine(ISurfaceBox surfaceBox, int x, int y, int x1, int y1) : base()
- {
- this.objectType = DrawClass.Interaction;
- this.drawToolType = DrawToolType.BinaryConnectionLine;
- this.ISurfaceBox = surfaceBox;
- startPoint.X = x;
- startPoint.Y = y;
- endPoint.X = x1;
- endPoint.Y = y1;
- Initialize();
- }
- public override DrawObject Clone()
- {
- return null;
- }
- public override void Draw(Graphics g)
- {
- g.SmoothingMode = SmoothingMode.AntiAlias;
- Pen pen = new Pen(Color.Red, this.ISurfaceBox.GetConnectionWidth());
- pen.DashStyle = DashStyle.Dash;
- g.DrawLine(pen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
- pen.Dispose();
- }
- public override RectangleF GetBoundingBox()
- {
- return rectangle;
- }
- public override void MoveHandleTo(Point point, int handleNumber)
- {
- if (handleNumber == 1)
- startPoint = point;
- else
- endPoint = point;
- }
- }
- }
|