C#画点 我想用C#画点.然后鼠标移动事件里面画.但是画出来效果不行!鼠标移动快了点就分开了.而不是连接成一个线!!哪个大哥能帮忙解决下?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 MouseMove的事件里面画上一个点的位置到当前鼠标点的线段,并在上一个点和当前鼠标点的位置画一个圆,用线条的颜色进行填充,然后记录当前位置为上一个点。说得比较绕,不过意思还是很简单的 Point opt = Point.Empty; private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { Graphics g= this.CreateGraphics(); Point npt = new Point(e.X, e.Y); if (opt.IsEmpty) opt = npt; Pen p = new Pen(System.Drawing.Color.Red); p.Width = 1; g.DrawLine(p, opt, npt); opt = npt; } 这个跟ms的系统设计有关系吧。除非你移动的慢一些,画的点大一些。否则没有解决方案。参考代码:Point opt = Point.Empty; private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { Graphics g= this.CreateGraphics(); Point npt = new Point(e.X, e.Y); if (opt.IsEmpty) opt = npt; Pen p = new Pen(System.Drawing.Color.Red); p.Width = 1; g.DrawLine(p, opt, npt); opt = npt; } c# winform excel导入access 求C#控件! 解释下小程序,静态方法出错问题 关于ControlDesigner类的例子,从MSDN上考下来的,但包错了,请高手指点。 odbc操作excel文件的简单问题 RichEditBox的几个小问题: webform中checkboxlist如何判断哪个选项被选中?谢谢 wpf工厂模式操作Sqlserver没问题操作Oracle就有问题 wpf使用treeview怎么建立目录文件夹形式的结构? 如何获取网卡、CPU的硬件代码??? axMediaPlayer控件的使用 winforms 中图片的更新
private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
Graphics g= this.CreateGraphics();
Point npt = new Point(e.X, e.Y);
if (opt.IsEmpty) opt = npt;
Pen p = new Pen(System.Drawing.Color.Red);
p.Width = 1;
g.DrawLine(p, opt, npt);
opt = npt;
}
参考代码:
Point opt = Point.Empty;
private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
Graphics g= this.CreateGraphics();
Point npt = new Point(e.X, e.Y);
if (opt.IsEmpty) opt = npt;
Pen p = new Pen(System.Drawing.Color.Red);
p.Width = 1;
g.DrawLine(p, opt, npt);
opt = npt;
}