コード例 #1
0
        /// <summary>
        /// 画轨迹
        /// </summary>
        public void DrawTrack(Point targetPoint)
        {
            if (this.InvokeRequired)
            {
                DrawTrackDelegate d = new DrawTrackDelegate(DrawTrack);
                this.BeginInvoke(d, new object[] { targetPoint });
            }
            else
            {
                if (lastPoint == null)
                {
                    lastPoint = targetPoint;
                    return;
                }

                graphics.DrawLine(new Pen(penColor, penWidth), (Point)lastPoint, targetPoint);
                lastPoint = targetPoint;
            }
        }
コード例 #2
0
 /// <summary>
 /// 画轨迹
 /// </summary>
 public void DrawTrack(Point targetPoint)
 {
     if (this.InvokeRequired)
     {
         DrawTrackDelegate d = new DrawTrackDelegate(DrawTrack);
         this.BeginInvoke(d, new object[] { targetPoint });
     }
     else
     {
         if (pointCount < 3)
         {
             this.BringToFront();
             pointCount++;
             lastPoint = targetPoint;
             return;
         }
         graphics.DrawLine(new Pen(penColor, penWidth), lastPoint, targetPoint);
         lastPoint = targetPoint;
     }
 }