我正在尝试创建一个新窗口,
WinMain meniu = new WinMain();
this.Close();
meniu.ShowDialog();
我想知道如何在新窗口中添加按钮之类的内容以及如何编辑它的参数甚至像
这样的函数private void Window_Loaded(object sender, RoutedEventArgs e)
答案 0 :(得分:0)
这是一个Windows窗体样本,我在创建窗体后添加了一个按钮:
var form = new Form1();
form.SuspendLayout();
var button2 = new System.Windows.Forms.Button();
button2.Location = new System.Drawing.Point(279, 20);
button2.Name = "button1";
button2.Size = new System.Drawing.Size(75, 23);
button2.TabIndex = 0;
button2.Text = "button1";
button2.UseVisualStyleBackColor = true;
form.Controls.Add(button2);
form.ResumeLayout(false);
Application.Run(form);