private void MainForm_Resize(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Maximized) { button3.Image = Resource2.还原; } else { button3.Image = Resource2.最大化; } Form1 form = null; setting form2 = null; foreach (Control i in tabControl1.SelectedTab.Controls) { if (i is Form1) { form = (Form1)i; } if (i is setting) { form2 = (setting)i; } } if (form != null) { form.resize(this.Width, tabControl1.Height); } if (form2 != null) { form2.Width = this.Width; form2.Height = tabControl1.Height; } }
public void addPage(setting form) { TabPage tb = new TabPage(); tb.Text = "设置"; tb.Controls.Add(form); tabControl1.TabPages.Add(tb); form.Width = this.Width; form.Height = tabControl1.Height; form.Show(); tabControl1.SelectedTab = tb; button1.Location = new Point(tabControl1.ItemSize.Width * tabControl1.TabPages.Count, 0); }
private void 设置ToolStripMenuItem_Click(object sender, EventArgs e) { setting setform = new setting(); mf.addPage(setform); }