private void FrmMianZjm_Load(object sender, EventArgs e) { //设置主页按钮颜色 this.btnHome.BackColor = Color.FromArgb(34, 187, 255); this.lkUserName.Text = UserName; this.labTime.Text = DateTime.Now.ToString("MM月dd日 hh:mm:ss"); //加载主页 FrmHome home = new FrmHome(); home.TopLevel = false; home.Dock = DockStyle.Fill;//把子窗体设置为控件 home.FormBorderStyle = FormBorderStyle.None; this.panHome.Controls.Clear(); this.panHome.Controls.Add(home); home.UserID = UserID; home.Show(); }
private void btnHome_Click(object sender, EventArgs e) { if (this.btnHome.BackColor == Color.Transparent)//判断按钮颜色 { this.btnHome.BackColor = Color.FromArgb(24, 187, 255); this.BtnClassification.BackColor = Color.Transparent; this.btnRanking.BackColor = Color.Transparent; this.btnOrder.BackColor = Color.Transparent; } FrmHome home = new FrmHome(); home.TopLevel = false; home.Dock = DockStyle.Fill;//把子窗体设置为控件 home.FormBorderStyle = FormBorderStyle.None; this.panHome.Controls.Clear(); this.panHome.Controls.Add(home); home.UserID = UserID; home.Show(); }