private void draw_circleGoButton() {/*draw the right blue circle Button*/ if (this.InvokeRequired) { this.Invoke(new MethodInvoker(this.draw_circleGoButton)); } else { // Create a Button object circleGoButton = new ButtonEllipse(); // radius of circle button int diameter = objdiameter; // Set Button properties circleGoButton.Location = new Point(Width - diameter - rightgap, Height / 2 - diameter / 2); circleGoButton.Height = diameter; circleGoButton.Width = diameter; // Set background and foreground circleGoButton.BackColor = Color.Blue; circleGoButton.Name = "circleGoButton"; // Add a Button Click Event handler circleGoButton.Click += new EventHandler(circleGoButton_Click); // tag for clicked or not goNogoButton_IsClicked = false; this.Controls.Add(circleGoButton); circleGoButton.Update(); } }
private void circleGoButton_Click(object sender, EventArgs e) { ButtonEllipse btn = sender as ButtonEllipse; btn.BackColor = Color.Yellow; circleGoButton.Update(); goNogoButton_IsClicked = true; }
private void interface_ready() { if (this.InvokeRequired) { this.Invoke(new MethodInvoker(this.interface_ready)); } else { g.Clear(Color.Black); if (circleGoButton != null) { Controls.Remove(circleGoButton); circleGoButton.Dispose(); circleGoButton = null; } if (squareNogoButton != null) { Controls.Remove(squareNogoButton); squareNogoButton.Dispose(); squareNogoButton = null; } } }