我一个Button添加了下面几个事件 public void button_MouseDown(object sender, MouseEventArgs e) { mous
我一个Button添加了下面几个事件publicvoidbutton_MouseDown(objectsender,MouseEventArgse){mouseDown=...
我一个Button添加了下面几个事件
public void button_MouseDown(object sender, MouseEventArgs e)
{
mouseDown = true;
}
private void button_MouseMove(object sender, MouseEventArgs e)
{
if (mouseDown)
{
panel.DoDragDrop((Panel)(((Button)sender).Parent), DragDropEffects.Move);
}
mouseDown = false;
}
private void button_MouseUp(object sender, MouseEventArgs e)
{
mouseDown = false;
}
private void button_Click(object sender, EventArgs e)
{
txb = (TextBox)((Button)sender).Tag;
Form2 fm = new Form2(txb);
fm.ShowDialog();
}
是不是DoDragDrop、mousedown、mouseup这几个事件有冲突啊?我一开始运行时点击button没问题(可以弹出窗口)
可是拖动按钮后Click事件就失效了。怎么解决?
恩。去掉那两个事件点击事件没问题。可是怎么实现DoDragDrop、mousedown、mouseup、click共存。不相互影响 展开
public void button_MouseDown(object sender, MouseEventArgs e)
{
mouseDown = true;
}
private void button_MouseMove(object sender, MouseEventArgs e)
{
if (mouseDown)
{
panel.DoDragDrop((Panel)(((Button)sender).Parent), DragDropEffects.Move);
}
mouseDown = false;
}
private void button_MouseUp(object sender, MouseEventArgs e)
{
mouseDown = false;
}
private void button_Click(object sender, EventArgs e)
{
txb = (TextBox)((Button)sender).Tag;
Form2 fm = new Form2(txb);
fm.ShowDialog();
}
是不是DoDragDrop、mousedown、mouseup这几个事件有冲突啊?我一开始运行时点击button没问题(可以弹出窗口)
可是拖动按钮后Click事件就失效了。怎么解决?
恩。去掉那两个事件点击事件没问题。可是怎么实现DoDragDrop、mousedown、mouseup、click共存。不相互影响 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询