1.利用panel形式,可以進行多行的展示
private void PB_Click(object sender, EventArgs e)
{
if (sender is Button)
{
Button temp = (Button)sender;
if (temp.TabIndex == FormIndex)
{
return;
}
else
{
FormIndex = temp.TabIndex;
}
}
else
{
FormIndex=0;
}
for (int i = 0; i < this.MdiChildren.Length; i++)
{
((Form)(this.MdiChildren[i])).Close();
}
Form Frm = null;
//1.登錄
//2.單元格管理
//3.IO管理
//4.工藝
//5.產品
//6.生產
//7.分析
//8.警報
//9.設置
if (FormIndex==0)
{
Frm = new Frm_Login();
}
if (FormIndex == 1)
{
Frm = new Frm_Cell();
}
if (FormIndex == 2)
{
Frm = new Frm_IO();
}
if (FormIndex ==3)
{
Frm = new Frm_Preset();
}
if (FormIndex == 4)
{
Frm = new Frm_Recipe();
}
if (FormIndex ==5)
{
Frm = new Frm_Product();
}
if (FormIndex == 6)
{
Frm = new Frm_Analysis();
}
if (FormIndex ==7)
{
Frm = new Frm_Alarm();
}
if (FormIndex == 8)
{
Frm = new Frm_Setting();
}
Frm.MdiParent = this;
Frm.Size = this.PanForm.Size;
Frm.WindowState = FormWindowState.Maximized;
this.PanForm.Controls.Add(Frm);
Frm.Dock = DockStyle.Fill;
Frm.Show();
}
利用button來實現文字與圖片共存效果
this.BT_Product.Anchor = System.Windows.Forms.AnchorStyles.None;
this.BT_Product.BackColor = System.Drawing.Color.Transparent;
this.BT_Product.FlatAppearance.BorderColor = System.Drawing.Color.White;
this.BT_Product.FlatAppearance.BorderSize = 0;
this.BT_Product.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.BT_Product.Font = new System.Drawing.Font("Arial", 10F, System.Drawing.FontStyle.Bold);
this.BT_Product.Image = global::PanMAN.Properties.Resources.Staubli_painting1;
this.BT_Product.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
this.BT_Product.Location = new System.Drawing.Point(52, 358);
this.BT_Product.Name = "BT_Product";
this.BT_Product.Size = new System.Drawing.Size(88, 61);
this.BT_Product.TabIndex = 5;
this.BT_Product.Text = "生產管理";
this.BT_Product.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
this.BT_Product.UseVisualStyleBackColor = true;
this.BT_Product.Click += new System.EventHandler(this.PB_Click);