private void SwitchPage(object sender, MouseEventArgs e) { string name = ((Label)sender).Text; foreach (Panel pnl in Controls.OfType <Panel>().Where(x => x.Name.ToLower().StartsWith("page"))) { string pnlName = pnl.Name.Substring(4, pnl.Name.Length - 4); if (pnlName == name) { pnl.Show(); } else { pnl.Hide(); } } if (CurrentTab != null) { CurrentTab.DefaultColor = Color.Transparent; } CurrentTab = ((MaterialAPI.Label)sender); CurrentTab.DefaultColor = Color.FromArgb(75, 255, 255, 255); }
private void Initialize() { PreviewBox = new MaterialAPI.PictureBox(); PreviewBox.Size = new Size(PREVIEW_WIDTH, PREVIEW_HEIGHT); PreviewBox.Location = new Point(0, 0); PreviewBox.SizeMode = PictureBoxSizeMode.StretchImage; PreviewBox.BackColor = Color.Black; MaterialAPI.Label l = new MaterialAPI.Label(); l.AutoSize = false; l.AutoEllipsis = true; l.UseCompatibleTextRendering = true; l.Size = new Size(PREVIEW_WIDTH, 25); l.Location = PreviewBox.Location; l.TextAlign = ContentAlignment.MiddleCenter; l.BackColor = Color.FromArgb(200, 30, 30, 30); l.ForeColor = Color.White; l.Font = new Font("Segoe UI", 12, FontStyle.Regular); l.Name = "PopupTitle"; PreviewBox.Controls.Add(l); Controls.Add(PreviewBox); }