在c#里怎么实现移动鼠标自由画图的功能,就像windows画图程序里用铅笔画这样。我用过在mousemove事件里根据鼠标坐标来画,但是这种方式如果鼠标移动快了,画出来的线就不连续了,有没有什么好的方法。
解决方案 »
- exe怎样向dll传消息?
- 急!!!找一本关于C#.net的C/S模式的书!
- .net 有 32/64 位之分吗?
- Session判断问题~
- *******百分求可用的RICHTEXTBOX**********
- C# 如何实现打开一个文件夹的(连接到本地硬盘的文件夹) 谢谢各位兄弟
- 请各位大虾给予帮助。。。走过的路过的也帮忙看看!!!
- 急,请教怎样用C#做统计代码行数的工具?
- 请问C#如何向xml文件中添加原素??
- 有难度的问题:在另一个线程里面form.showDialog()会block此线程,而且这个form不是像主线程里面showdialog()那样,用户必须完成,请教怎
- C# 如何实现类的注册...
- C#winform中,datagridview单元个问题
bool isStartToDraw = false;
Point startPoint = new Point(); private void Form1_MouseDown(object sender, MouseEventArgs e)
{
isStartToDraw = true;
startPoint = e.Location;
} private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (isStartToDraw)
{
Graphics graphics = this.CreateGraphics();
graphics.DrawLine(Pens.Black, startPoint, e.Location);
startPoint = e.Location;
}
} private void Form1_MouseUp(object sender, MouseEventArgs e)
{
isStartToDraw = false;
}
protected override void OnPaint(PaintEventArgs pe)
{
Graphics g = pe.Graphics;
Pen pen = new Pen(Color.Blue);
g.DrawRectangle(pen,3,3,button1.Width-8,button1.Height-8);
base.Paint(pe);
}
{
Graphics graphics = this.CreateGraphics();
graphics.DrawLine(Pens.Black, startPoint, e.Location);
startPoint = e.Location;
graphics.Dispose();
}
graphics.DrawCurve方法就可以了