c# - Adding a circular button to a Windows Form -


I have created a round button in a windows form. The button is fine. The only problem is that I want a different color for the background, so I'm setting up Bangalore in GoldenRoad. However, it only creates a "goldenrod" cube around the circular button ... how do I make it, so that only the button becomes colored? Public Mainstream () {Initial Group (); MyButtonObject start = new myButtonObject (); EventHandler My Handler = New Event Handler (Startcall); Start.Click + = myHandler; Start.Location = New system. Drawing Points (5, 5); Start.Size = New System Drawing. Size (101, 101); Start.BackColor = System.Drawing.Color.Goldenrod; This.Controls.Add (start); `} Zero start_Click (Object Sender, System.EventArgs e) {MessageBox.Show (" Start "); } Public category myButtonObject: UserControl {// Draw new button. Secure Override Zero OnPaint (PaintEventArgs E) {Graphics Graphics = E. Graphics; Pen myPen = new pen (color black); // Draw a button as a circle graphic. Dryllepse (MyPene, 0, 0, 100, 100); myPen.Dispose (); }}

You need to fill Ellipse Onpan () drawing during the drawing.

  Graphics. FillEllipse (Brush Goldnode, new rectangle (0, 0, 100, 100)); Graphics Drylips (MyPain, 0, 0, 100, 100);   

Then make sure to remove the start.BackColor property from your mainform () constructor.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -