标签:
单击ToolStripMenuItem把需要显示的窗体显示在主窗体中
代码:
1 private void 客人预订ToolStripMenuItem_Click(object sender, EventArgs e)
2 {
3 Book book = new Book();
4 book.TopLevel = false;//将预订窗体设为:非顶级窗体
5 this.panel1.Controls.Add(book);
6 book.Show();//能不能把Book显示在MainForm中而不是弹出
7 book.Dock = DockStyle.Fill;//充满父级控件随其调整大小
8 //book.FormBorderStyle = FormBorderStyle.None;//设置窗体样式为:无边框
9 }
1 private void panel1_Resize(object sender, EventArgs e)
2 {
3 Book book = new Book();
4 book.ClientSize = new Size(panel1.Size.Width, panel1.Size.Height);//设置预订窗体工作区大小为panel控件的大小
5 }
标签:
原文地址:http://www.cnblogs.com/tanghb/p/4885546.html