【发布时间】:2012-11-19 06:41:13
【问题描述】:
我有两个 ma 形式的面板。 panel1 与 button1 位于位置让我们说 x:10,y:10 和 panel2 与 button 2 位于位置 x:10,y:10。
button1 的实际作用:- 它隐藏 panel1 并在同一位置显示 panel2。
但是每当我在完成其过程后单击 button1 两次时,它都会触发 button2 单击事件,
请尽快帮助我
希望下面的链接能清楚地展示我的问题
http://www.youtube.com/watch?v=bpojl4XMweo&feature=g-upl
编辑:
目前使用的代码
void hidepanel()
{
panel1.Visible = false;
panel2.Visible = false;
}
private void Form1_Load(object sender, EventArgs e)
{
hidepanel();
panel1.Visible = true;
panel2.Location = new Point(262,19);
panel1.Location = new Point(0, 0);
}
private void button1_Click(object sender, EventArgs e)
{
hidepanel();
panel2.Location = new Point(0, 0);
panel2.Visible = true;
}
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show("2");
}
【问题讨论】:
-
你是说双击button1,第一次点击触发button1,第二次触发button2?如果是这样,则在其事件处理程序中禁用 button1(或者可能是整个面板)。
-
我已经试过了..它不工作... :(
-
你能展示一些你的代码吗?也试试@josef 的回答。
-
void hidepanel() { panel1.Visible = false; panel2.Visible = false; } private void Form1_Load(object sender, EventArgs e) { hidepanel(); panel1.Visible = true; panel2.Location = 新点(262,19); panel1.Location = new Point(0, 0); } private void button1_Click(object sender, EventArgs e) { hidepanel(); panel2.Location = new Point(0, 0); panel2.Visible = true; } private void button2_Click(object sender, EventArgs e) { MessageBox.Show("2"); }
-
@Sid:- 我是新手,所以我不知道如何像 josef 那样显示代码.. 请用上面的代码进行管理.. :P 你也可以检查我的问题中提到的链接,如果需要...
标签: c# windows-mobile window