void dropPanel_ColorPicked(object sender, EventArgs e) { currentColor = dropPanel.CurrentColor; //if (currentColor is SolidColor) //{ // dropPanel.Visible = false; //} Invalidate(); if (ColorPicked != null) { ColorPicked.Invoke(this, new EventArgs()); } }
public ColorPickerPanel() : base() { this.TabStop = false; this.Margin = this.Padding = new Padding(1); this.AutoSize = false; panel = new Panel(); panel.TabStop = false; panel.AutoSize = false; panel.Location = new Point(0, 0); panel.Dock = DockStyle.Fill; tab = new FlatTabControl(); tab.TabStop = false; tab.Tabs = new string[] { "Solid" }; tab.Size = new Size(ClientRectangle.Width, 20); tab.Dock = DockStyle.Top; tab.SelectedIndexChanged += (s, e) => panels[tab.SelectedIndex].BringToFront(); Controls.Add(tab); Controls.Add(panel); solidPanel.Dock = DockStyle.Fill; solidPanel.ColorPicked += (s, e) => { currentColor = null; // new SolidColor(colorPickerPanel.CurrentColor); if (ColorPicked != null) { ColorPicked(this, e); } }; solidPanel.BringToFront(); panel.Controls.Add(solidPanel); panels.Add(solidPanel); this.Size = new Size(172, 220); panel.BringToFront(); }