简单的画图板,如何改进,让线条连续?

电脑杂谈  发布时间:2016-12-18 09:00:51  来源:网络整理

private Point LastPoint { get; set; }

private void Form1_MouseMove(object sender, MouseEventArgs e)

{

label2.Text = "x:" + e.X;

label3.Text = "y:" + e.Y;

if (drawing == true)

{

Graphics graphics = CreateGraphics();

SolidBrush brush = new SolidBrush(color);

if (LastPoint == null)

graphics.FillEllipse(brush, e.X, e.Y, size, size);

else

graphics.DrawLine(new Pen(brush, size), LastPoint, new Point(e.X, e.Y));

}

LastPoint = new Point(e.X, e.Y);

}


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-23013-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      • 王孟军
        王孟军

        @老子起个昵称怎么就那么难@郑甜甜的辛普森美美美

      热点图片
      拼命载入中...