2

我在第一个问题中得到了很大的帮助,希望有人会告诉我或将我推荐给有关此主题的较早问题。

我想链接不同的表单,例如单击第一个按钮并打开第二个表单。基本上,我将为手机功能(例如 SMS、CALL 等)制作一个菜单,所以如果我单击呼叫新表格打开,要求拨打电话等。

4

2 回答 2

3
var otherForm = new Form2();
otherForm.ShowDialog(); // To show a modal dialog, or...
otherForm.Show();  // To show it as a non-modal window
于 2009-05-01T15:04:21.093 回答
3
void SomeInitializationFunction() {
      button.Click += new System.EventHandler(buttonClick);
}

private void buttonClick(object sender, System.EventArgs e)
{
    using(GetNumberForm getNumberForm = new GetNumberForm())
    {
        if(DialogResult.OK == getNumberForm.ShowDialog())
        {
            string phoneNumber = getNumberForm.PhoneNumber;
            // do something with the user input.
        }
    }
}
于 2009-05-01T15:06:20.683 回答