我在一个窗口内点击一个按扭弹出一个新窗口
private void button2_Click(object sender, EventArgs e)
{
SelfDesign sdfrm = new SelfDesign();
sdfrm.ShowDialog();
}
在新窗口设定几个值之后,我将this.Visible = false;返回原来窗口怎么将原来的窗口刷新呢?,
要求在将this.Visible = false的同时,刷新原窗口...
private void button2_Click(object sender, EventArgs e)
{
SelfDesign sdfrm = new SelfDesign();
sdfrm.ShowDialog();
}
在新窗口设定几个值之后,我将this.Visible = false;返回原来窗口怎么将原来的窗口刷新呢?,
要求在将this.Visible = false的同时,刷新原窗口...
都隐藏了还刷新,为什么啊?能不能等到再显示时刷新。另外,窗口是用户界面,业务逻辑不用在界面体现,只用来输出。
configForm.StartPosition = FormStartPosition.CenterScreen;
configForm.ShowDialog();
if(configForm.bUpdate)
{
m_ConfigIniFile.WriteString("SYSTEM", "SERVERIP", configForm.strIP);
m_ConfigIniFile.WriteString("SYSTEM", "SERVERPORT", configForm.strPort);
}下面是子窗口中输入服务器IP,port
private void btUpdate_Click(object sender, EventArgs e)
{
strIP = txtIP.Text;
strPort = txtPort.Text;
try
{
System.Net.IPAddress.Parse(strIP);
Convert.ToInt32(strPort);
System.Net.IPAddress.Parse(strMSIP);
}
catch (System.Exception eConfig)
{
eConfig.ToString();
MessageBox.Show("请检查IP地址及端口格式。\n", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
bUpdate = true;
this.Close();
}关闭窗口子窗口的实例还在,可以直接调用其中变量。
Button button = new Button();
button.Size = new Size(80, 20);
button.Text = "OK";
button.Location = new Point(10, 10);
groupBox1.Controls.Add(button);我添加一个按扭,怎么添加他的点击事件啊?
button.Click += new System.EventHandler(button_Click);private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("点击事件");
}
button.Size = new Size(80, 20);
button.Text = "OK";
button.Location = new Point(10, 10);
groupBox1.Controls.Add(button);
Button.Click += new System.EventHandler(button_Click);private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("这就是你创建新按钮的事件");
}
刚才试了一下,可以
不过,还有一个问题,因为按扭是动态生成 的,不知道个数啊,Button.Click += new System.EventHandler(button_Click);
这里面的button_Click怎么写啊
按扭不是调用同一事件啊