form窗体调用的ShowDialog() form.dispose();form.close();不起作用
代码如下System.Windows.Forms.TextBoxtextbox1=newSystem.Windows.Forms.TextBox();System.Win...
代码如下
System.Windows.Forms.TextBox textbox1 = new System.Windows.Forms.TextBox();
System.Windows.Forms.Button button1 = new System.Windows.Forms.Button();
System.Windows.Forms.Button button2 = new System.Windows.Forms.Button();
form1.AcceptButton = button1;
button1.Click += new EventHandler(OK_Click);
form1.CancelButton = button2;
form1.Controls.Add(textbox1);
form1.Controls.Add(button1);
form1.Controls.Add(button2);
form1.ShowDialog();
private void OK_Click(object sender, EventArgs e)
{
form1.Dispose();
form1.Close();
} 展开
System.Windows.Forms.TextBox textbox1 = new System.Windows.Forms.TextBox();
System.Windows.Forms.Button button1 = new System.Windows.Forms.Button();
System.Windows.Forms.Button button2 = new System.Windows.Forms.Button();
form1.AcceptButton = button1;
button1.Click += new EventHandler(OK_Click);
form1.CancelButton = button2;
form1.Controls.Add(textbox1);
form1.Controls.Add(button1);
form1.Controls.Add(button2);
form1.ShowDialog();
private void OK_Click(object sender, EventArgs e)
{
form1.Dispose();
form1.Close();
} 展开
展开全部
代码贴全了吗
我试了试 可以 不知道是不是我理解错了 测试代码如下:
public partial class Form3 : Form
{
Form form = null;
public Form3()
{
InitializeComponent();
}
private void OK_Click(object sender, EventArgs e)
{
form.Dispose();
form.Close();
}
private void button1_Click(object sender, EventArgs e)
{
form = new Form();
TextBox textbox1 = new TextBox();
Button button1 = new Button();
Button button2 = new Button();
form.AcceptButton = button1;
button1.Click += new EventHandler(OK_Click);
form.CancelButton = button2;
button1.Location = new Point(0, 100);
button1.Text = "关闭";
button2.Location = new Point(100, 100);
textbox1.Location = new Point(0, 0);
form.Controls.Add(textbox1);
form.Controls.Add(button1);
form.Controls.Add(button2);
form.ShowDialog();
}
}
我试了试 可以 不知道是不是我理解错了 测试代码如下:
public partial class Form3 : Form
{
Form form = null;
public Form3()
{
InitializeComponent();
}
private void OK_Click(object sender, EventArgs e)
{
form.Dispose();
form.Close();
}
private void button1_Click(object sender, EventArgs e)
{
form = new Form();
TextBox textbox1 = new TextBox();
Button button1 = new Button();
Button button2 = new Button();
form.AcceptButton = button1;
button1.Click += new EventHandler(OK_Click);
form.CancelButton = button2;
button1.Location = new Point(0, 100);
button1.Text = "关闭";
button2.Location = new Point(100, 100);
textbox1.Location = new Point(0, 0);
form.Controls.Add(textbox1);
form.Controls.Add(button1);
form.Controls.Add(button2);
form.ShowDialog();
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
网易云信
2023-12-06 广告
2023-12-06 广告
UIkit是一套轻量级、模块化且易于使用的开源UI组件库,由YOOtheme团队开发。它提供了丰富的界面元素,包括按钮、表单、表格、对话框、滑块、下拉菜单、选项卡等等,适用于各种类型的网站和应用程序。UIkit还支持响应式设计,可以根据不同...
点击进入详情页
本回答由网易云信提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询