📄 mainform.cs
字号:
this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
//
// toolBarButton1
//
this.toolBarButton1.ImageIndex = 0;
this.toolBarButton1.Text = "客房类型管理";
//
// toolBarButton2
//
this.toolBarButton2.ImageIndex = 8;
this.toolBarButton2.Text = "客房管理";
//
// toolBarButton3
//
this.toolBarButton3.ImageIndex = 2;
this.toolBarButton3.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// toolBarButton4
//
this.toolBarButton4.ImageIndex = 2;
this.toolBarButton4.Text = "客房查询";
//
// toolBarButton5
//
this.toolBarButton5.ImageIndex = 4;
this.toolBarButton5.Text = "客户查询";
//
// toolBarButton6
//
this.toolBarButton6.ImageIndex = 3;
this.toolBarButton6.Text = "客户入住";
//
// toolBarButton7
//
this.toolBarButton7.ImageIndex = 1;
this.toolBarButton7.Text = "客户结算";
//
// toolBarButton8
//
this.toolBarButton8.ImageIndex = 6;
this.toolBarButton8.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// toolBarButton11
//
this.toolBarButton11.ImageIndex = 9;
this.toolBarButton11.Text = "用户管理";
//
// toolBarButton9
//
this.toolBarButton9.ImageIndex = 6;
this.toolBarButton9.Text = "系统帮助";
//
// toolBarButton10
//
this.toolBarButton10.ImageIndex = 7;
this.toolBarButton10.Text = "退出系统";
//
// imageList1
//
this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// MainForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.Window;
this.ClientSize = new System.Drawing.Size(644, 525);
this.Controls.Add(this.toolBar1);
this.Controls.Add(this.splitter1);
this.ForeColor = System.Drawing.SystemColors.Desktop;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.IsMdiContainer = true;
this.Menu = this.mainMenu1;
this.Name = "MainForm";
this.Text = "主窗体";
this.Load += new System.EventHandler(this.MainForm_Load);
this.ResumeLayout(false);
}
#endregion
static void Main()
{
Thread thread = Thread.CurrentThread;
thread.ApartmentState = ApartmentState.STA;
Application.Run(new MainForm());
}
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
private void menuItem5_Click(object sender, System.EventArgs e)
{
Form RoomTypeForm=new RoomType();
for(int x=0;x<this.MdiChildren.Length;x++)
{
Form tempChild = (Form)this.MdiChildren[x];
tempChild.Close();
}
RoomTypeForm.MdiParent = this;//setup MdiParent for expertMaintenance form
RoomTypeForm.WindowState = FormWindowState.Maximized;
RoomTypeForm.Show();
}
private void menuItem3_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
private void menuItem6_Click(object sender, System.EventArgs e)
{
Form RoomForm=new Room();
for(int x=0;x<this.MdiChildren.Length;x++)
{
Form tempChild = (Form)this.MdiChildren[x];
tempChild.Close();
}
RoomForm.MdiParent = this;//setup MdiParent for expertMaintenance form
RoomForm.WindowState = FormWindowState.Maximized;
RoomForm.Show();
}
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
switch(toolBar1.Buttons.IndexOf(e.Button))
{//根据单击ToolBar上的Button的索引不同而触发不同的事件
case 0:
Form RoomTypeForm=new RoomType();
//创建RoomType的实例
for(int x=0;x<this.MdiChildren.Length;x++)
{
Form tempChild = (Form)this.MdiChildren[x];
tempChild.Close();
}
//关闭主窗体的其他子窗体
RoomTypeForm.MdiParent = this;
//设置主窗体为父窗体
RoomTypeForm.WindowState = FormWindowState.Maximized;
//最大化子窗体
RoomTypeForm.Show();
break; //跳出Switch
case 1:
Form RoomForm=new Room();
for(int x=0;x<this.MdiChildren.Length;x++)
{
Form tempChild = (Form)this.MdiChildren[x];
tempChild.Close();
}
RoomForm.MdiParent = this;//setup MdiParent for expertMaintenance form
RoomForm.WindowState = FormWindowState.Maximized;
RoomForm.Show();
break;
case 3:
case 5:
Form RoomSearchForm=new RoomSearch();
for(int x=0;x<this.MdiChildren.Length;x++)
{
Form tempChild = (Form)this.MdiChildren[x];
tempChild.Close();
}
RoomSearchForm.MdiParent = this;//setup MdiParent for expertMaintenance form
RoomSearchForm.WindowState = FormWindowState.Maximized;
RoomSearchForm.Show();
break;
case 4:
case 6:
Form ClientSearchForm=new ClientSearch();
for(int x=0;x<this.MdiChildren.Length;x++)
{
Form tempChild = (Form)this.MdiChildren[x];
tempChild.Close();
}
ClientSearchForm.MdiParent = this;//setup MdiParent for expertMaintenance form
ClientSearchForm.WindowState = FormWindowState.Maximized;
ClientSearchForm.Show();
break;
case 10:
Application.Exit();
break;
}
}
private void menuItem8_Click(object sender, System.EventArgs e)
{
Form RoomBookIn=new RoomSearch();
for(int x=0;x<this.MdiChildren.Length;x++)
{
Form tempChild = (Form)this.MdiChildren[x];
tempChild.Close();
}
RoomBookIn.MdiParent = this;//setup MdiParent for expertMaintenance form
RoomBookIn.WindowState = FormWindowState.Maximized;
RoomBookIn.Show();
}
private void menuItem9_Click(object sender, System.EventArgs e)
{
Form RoomTypeForm=new ClientSearch();
for(int x=0;x<this.MdiChildren.Length;x++)
{
Form tempChild = (Form)this.MdiChildren[x];
tempChild.Close();
}
RoomTypeForm.MdiParent = this;//setup MdiParent for expertMaintenance form
RoomTypeForm.WindowState = FormWindowState.Maximized;
RoomTypeForm.Show();
}
private void MainForm_Load(object sender, System.EventArgs e)
{
Form RoomBookIn=new InitialForm();
RoomBookIn.MdiParent = this;//setup MdiParent for expertMaintenance form
RoomBookIn.WindowState = FormWindowState.Maximized;
RoomBookIn.Show();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -