示例#1
0
 public override void Draw(Graphics gp)
 {
     //Closed Curve phải có tối thiểu 3 điểm để vẽ
     //Nếu ít hơn 3 điểm, thì vẽ các điểm hiện có
     if (LPoints.Count < 3)
     {
         using (var tmpBrush = new SolidBrush(Pen.Color))
             LPoints.ForEach(p => gp.FillRectangle(tmpBrush, new Rectangle(p.X - 3, p.Y - 3, 6, 6)));
         return;
     }
     GPPaths.Reset();
     GPPaths.AddClosedCurve(LPoints.ToArray());
     if (IsFilled)
     {
         gp.FillClosedCurve(Brush, LPoints.ToArray());
     }
     if (IsDrawBorder)
     {
         gp.DrawClosedCurve(Pen, LPoints.ToArray());
     }
     if (IsSelected)
     {
         using (var brush = new SolidBrush(Color.Blue))
             LPoints.ForEach(p => gp.FillRectangle(brush, new Rectangle(p.X - 3, p.Y - 3, 6, 6)));
     }
 }
示例#2
0
 /// <summary>
 /// Dùng để xác định một hình có được chọn hay không
 /// </summary>
 /// <param name="p">Vị trí điểm được xét có thuộc hình hay không </param>
 /// <returns>True nếu hình được chọn </returns>
 public virtual bool Select(Point p)
 {
     if (IsFilled)
     {
         return(GPPaths.IsVisible(p));
     }
     return(GPPaths.IsOutlineVisible(p, Pen));
 }
示例#3
0
 public override void Draw(Graphics gp)
 {
     gp.DrawCurve(Pen, LPoints.ToArray());
     GPPaths.Reset();
     GPPaths.AddCurve(LPoints.ToArray());
     if (IsSelected)
     {
         using (var brush = new SolidBrush(Color.Blue))
             LPoints.ForEach(p => gp.FillRectangle(brush, new Rectangle(p.X - 4, p.Y - 4, 8, 8)));
     }
 }
示例#4
0
文件: MyLine.cs 项目: tsdocode/HCMUTE
 public override void Draw(Graphics gp)
 {
     gp.DrawLine(Pen, P1, P2);
     GPPaths.Reset();
     GPPaths.AddLine(P1, P2);
     if (IsSelected)
     {
         Brush brush = new SolidBrush(Color.Blue);
         gp.FillRectangle(brush, P1.X - 3, P1.Y - 3, 6, 6);
         gp.FillRectangle(brush, P2.X - 3, P2.Y - 3, 6, 6);
     }
 }
示例#5
0
 public override void Draw(Graphics gp)
 {
     try
     {
         RectShape = DetectBound();
         GPPaths.Reset();
         GPPaths.AddArc(RectShape, StartAngle, SweepAngle);
         gp.DrawArc(Pen, RectShape, StartAngle, SweepAngle);
         if (IsSelected)
         {
             using (var pen = new Pen(Color.Blue)
             {
                 Width = 2, DashStyle = System.Drawing.Drawing2D.DashStyle.Dash
             })
             {
                 gp.DrawRectangle(pen, RectShape);
             }
         }
     }
     catch { }
 }
示例#6
0
 public override void Draw(Graphics gp)
 {
     RectShape = DetectBound();
     GPPaths.Reset();
     GPPaths.AddEllipse(RectShape);
     if (IsFilled)
     {
         gp.FillEllipse(Brush, RectShape);
     }
     if (IsDrawBorder)
     {
         gp.DrawEllipse(Pen, RectShape);
     }
     if (IsSelected)
     {
         Brush brush = new SolidBrush(Color.Blue);
         gp.FillRectangle(brush, (P1.X + P2.X) / 2 - 4, P1.Y - 4, 8, 8);
         gp.FillRectangle(brush, (P1.X + P2.X) / 2 - 4, P2.Y - 4, 8, 8);
         gp.FillRectangle(brush, P1.X - 4, (P1.Y + P2.Y) / 2 - 4, 8, 8);
         gp.FillRectangle(brush, P2.X - 4, (P1.Y + P2.Y) / 2 - 4, 8, 8);
     }
 }
示例#7
0
 public override void Draw(Graphics gp)
 {
     GPPaths.Reset();
     GPPaths.AddCurve(LPoints.ToArray());
     if (IsFilled)
     {
         gp.FillPath(Brush, GPPaths);
     }
     if (IsDrawBorder)
     {
         gp.DrawPath(Pen, GPPaths);
     }
     if (IsSelected)
     {
         using (Brush brush = new SolidBrush(Color.Blue))
         {
             for (int i = 0; i < LPoints.Count; i += 4)
             {
                 gp.FillRectangle(brush, LPoints[i].X - 4, LPoints[i].Y - 4, 8, 8);
             }
         }
     }
 }