首页 > 其他 > 详细

十字光标定位

时间:2019-01-15 21:56:15      阅读:213      评论:0      收藏:0      [点我收藏+]

实现效果:

  技术分享图片

知识运用:

  Graphics对象的DrawLine方法

  public void DrawLine (Pen pen, Point pt1,Point pt2)

  public void DrawLine (Pen pen, int x1,int y1,int x2,int y2)

实现代码:

        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            Graphics g = this.CreateGraphics();
            g.DrawLine(new Pen(Color.Black,2),new Point(0,e.Y),new Point(this.Width,e.Y));
            g.DrawLine(new Pen(Color.Black, 2), new Point(e.X, 0), new Point(e.X,this.Height));
        }

 

十字光标定位

原文:https://www.cnblogs.com/feiyucha/p/10274393.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!