关于mousedown、mouseup、mousemove、C#

privatevoidtoolStripButton3_Click_1(objectsender,EventArgse){this.pbImg.MouseDown+=ne... private void toolStripButton3_Click_1(object sender, EventArgs e)
{

this.pbImg.MouseDown += new MouseEventHandler(toolStripButton3_MouseDown);

this.pbImg.MouseUp += new MouseEventHandler(toolStripButton3_MouseUp);

this.pbImg.MouseMove += new MouseEventHandler(toolStripButton3_MouseMove);
private void FillCircle_Click(object sender, EventArgs e)
{

this.pbImg.MouseDown += new MouseEventHandler(FillCircle_MouseDown);

this.pbImg.MouseUp += new MouseEventHandler(FillCircle_MouseUp);

this.pbImg.MouseMove += new MouseEventHandler(FillCircle_MouseMove);
}

}

如何不让mouseup、mousedown、mousemove反复执行,画直线的时候就画直线,画矩形的时候就画矩形

错误的事例如下图矩形和直线同时画
展开
 我来答
zhang_junchen
2010-01-18 · TA获得超过3019个赞
知道小有建树答主
回答量:858
采纳率:0%
帮助的人:1094万
展开全部
在add之前先remove掉就行了:
private void toolStripButton3_Click_1(object sender, EventArgs e)
{
this.pbImg.MouseDown -= new MouseEventHandler(FillCircle_MouseDown);

this.pbImg.MouseUp -= new MouseEventHandler(FillCircle_MouseUp);

this.pbImg.MouseMove -= new MouseEventHandler(FillCircle_MouseMove);
this.pbImg.MouseDown += new MouseEventHandler(toolStripButton3_MouseDown);

this.pbImg.MouseUp += new MouseEventHandler(toolStripButton3_MouseUp);

this.pbImg.MouseMove += new MouseEventHandler(toolStripButton3_MouseMove);
}
private void FillCircle_Click(object sender, EventArgs e)
{
this.pbImg.MouseDown -= new MouseEventHandler(toolStripButton3_MouseDown);

this.pbImg.MouseUp -= new MouseEventHandler(toolStripButton3_MouseUp);

this.pbImg.MouseMove -= new MouseEventHandler(toolStripButton3_MouseMove);
this.pbImg.MouseDown += new MouseEventHandler(FillCircle_MouseDown);

this.pbImg.MouseUp += new MouseEventHandler(FillCircle_MouseUp);

this.pbImg.MouseMove += new MouseEventHandler(FillCircle_MouseMove);
}

}
wenzhong628
2010-01-17 · TA获得超过533个赞
知道小有建树答主
回答量:653
采纳率:0%
帮助的人:241万
展开全部
不懂
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式