public MyListItem(FlowLayoutPanel area, bool isArea) { ItemKind = isArea; userAreaPanel = area; Tb = new MyListItemTextBox(userAreaPanel, lbl, isArea); tb.ForeColor = Color.FromArgb(204, 202, 204); tb.Text = "New List"; if (isArea) { tb.Text = "New Area"; } this.Size = new Size(167, 18); this.Margin = new Padding(0, 1, 0, 0); this.BackColor = listHoverColor; if (!isArea) { pic.Image = Properties.Resources.circle; pic.Size = new Size(12, 12); lbl.Font = new Font("Corbel", 9.75f); Tb.Font = new Font("Corbel", 9.75f); } else { pic.Size = new Size(12, 13); pic.Image = Properties.Resources.area; lbl.Font = new Font("Corbel", 9.75f, FontStyle.Bold); } pic.SizeMode = PictureBoxSizeMode.StretchImage; pic.Location = new Point(3, 3); lbl.Location = new Point(19, 2); lbl.Size = new Size(130, 17); lbl.DoubleClick += textBoxDoubleClick; this.Controls.Add(pic); this.Controls.Add(lbl); this.Controls.Add(Tb); this.Click += (s, e) => MyInteraction.listClick(this); foreach (Control childControl in this.Controls) { childControl.Click += (s, e) => MyInteraction.listClick(((Control)s).Parent); } if (!isArea) { MyAnimation.SetListBtnColor(this); } else { this.Click += (s, e) => addAllList(this); } lbl.Visible = false; }
public MainForm() { mainform = this; InitializeComponent(); lastFocus = this; #region Basic Activated += MainForm_Activated; Deactivate += MainForm_Deactivate; foreach (var control in new[] { MinimizeLabel, CloseLabel }) { control.MouseEnter += (s, e) => SetLabelColors((Control)s, MouseState.Hover); control.MouseLeave += (s, e) => SetLabelColors((Control)s, MouseState.Normal); control.MouseDown += (s, e) => SetLabelColors((Control)s, MouseState.Down); } TopLeftCornerPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTTOPLEFT); TopRightCornerPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTTOPRIGHT); BottomLeftCornerPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTBOTTOMLEFT); BottomRightCornerPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTBOTTOMRIGHT); TopBorderPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTTOP); LeftBorderPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTLEFT); RightBorderPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTRIGHT); BottomBorderPanel.MouseDown += (s, e) => DecorationMouseDown(e, HitTestValues.HTBOTTOM); //SystemLabel.MouseDown += SystemLabel_MouseDown; //SystemLabel.MouseUp += SystemLabel_MouseUp; TitleLabel.MouseDown += TitleLabel_MouseDown; //TitleLabel.MouseUp += (s, e) => { if (e.Button == MouseButtons.Right && TitleLabel.ClientRectangle.Contains(e.Location)) ShowSystemMenu(MouseButtons); }; //TitleLabel.Text = Text; TextChanged += (s, e) => TitleLabel.Text = Text; var marlett = new Font("Marlett", 8.5f); MinimizeLabel.Font = marlett; //MaximizeLabel.Font = marlett; CloseLabel.Font = marlett; //SystemLabel.Font = marlett; MinimizeLabel.MouseClick += (s, e) => { if (e.Button == MouseButtons.Left) { WindowState = FormWindowState.Minimized; } }; //MaximizeLabel.MouseClick += (s, e) => { if (e.Button == MouseButtons.Left) ToggleMaximize(); }; previousWindowState = MinMaxState; SizeChanged += MainForm_SizeChanged; CloseLabel.MouseClick += (s, e) => Close(e); #endregion foreach (var control in new[] { panel2, panel3, panel4, panel5, panel6, panel7, panel8 }) { MyAnimation.SetListBtnColor(control); control.Click += (s, e) => MyInteraction.listClick((Control)s); foreach (Control childControl in control.Controls) { childControl.Click += (s, e) => MyInteraction.listClick(((Control)s).Parent); } } MyAnimation.AddMouseDownEvent(this); MyAnimation.SetListBtnColor(panel12); MyAnimation.SetbuttomBarBtnColor(panel28); AddNewItemBtn.Click += AddNewItemBtn_Click; panel28.Click += AddNewItemBtn_Click; MyAnimation.SetbuttomBarBtnColor(panel31); editBtn.Click += EditBtn_Click; panel31.Click += EditBtn_Click; //MyInteraction.listClick(panel2); }