private void ChangeColor(object sender, Color color) { RoundButton btn = (RoundButton)sender; Pen pen = new Pen(color); SolidBrush brush = new SolidBrush(color); btn.CreateGraphics().DrawEllipse(pen, 0, 0, 22, 22); btn.CreateGraphics().FillEllipse(brush, 0, 0, 22, 22); pen.Dispose(); }
public Form1() { InitializeComponent(); Parameter.Init(); this.Text = "AlphaESI-" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.Width = 1000; this.Height = 780; timeLabel.Location = new Point(productPanel.Location.X + productPanel.Width + 50, productPanel.Location.Y); timeValueLabel.Location = new Point(timeLabel.Location.X + timeLabel.Width + 5, timeLabel.Location.Y - 2); timeValueLabel.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now); hl9309PictureBox.Location = new Point(timeLabel.Location.X, timeLabel.Location.Y + timeLabel.Height + 20); hl9309PictureBox.Width = Parameter.Columns * Parameter.RectangleWeight + 1; hl9309PictureBox.Height = Parameter.Rows * Parameter.RectangleWeight + 1; hl9308PictureBox.Location = new Point(hl9309PictureBox.Location.X, hl9309PictureBox.Location.Y); hl9308PictureBox.Width = Parameter.Columns * Parameter.RectangleWeight + 1; hl9308PictureBox.Height = Parameter.Rows * Parameter.RectangleWeight + 1; exportBtn.Location = new Point(hl9309PictureBox.Location.X + hl9309PictureBox.Width - exportBtn.Width, hl9309PictureBox.Location.Y - exportBtn.Height - 10); zColorBtn1 = new RoundButton(); EventHandler handler1 = new EventHandler(zColorBtn1_Click); zColorBtn1.Click += handler1; zColorBtn1.Location = new Point(colorLabel.Location.X + 10, zThresholdTextBox.Location.Y); zColorBtn1.Size = new Size(23, 23); zColorBtn1.TabIndex = 11; thresholdPanel.Controls.Add(zColorBtn1); zColorBtn2 = new RoundButton(); EventHandler handler2 = new EventHandler(zColorBtn2_Click); zColorBtn2.Click += handler2; zColorBtn2.Location = new Point(colorLabel.Location.X + 10, zThresholdTextBox2.Location.Y); zColorBtn2.Size = new Size(23, 23); zColorBtn2.TabIndex = 12; thresholdPanel.Controls.Add(zColorBtn2); this.ActiveControl = logoPictureBox; }