c# - How do you add a label/text to a manually created button? -


I have created a button using the code below to start adding. Text = "start"; statement is nothing but how do I add a label to my button? Public Mainstream () {Initial Group (); MyButtonObject start = new myButtonObject (); EventHandler My Handler = New Event Handler (Startcall); Start.Click + = myHandler; Start.Location = new system.downing.point (200, 500); Start.Size = New System Drawing. Size (101, 101); Start.Text = "Start"; // start.TextAlign = New System.Downing. Resource Element. Middle center; This.Controls.Add (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 the button as a circle graphic. FillEllipse (Brush Goldnode, 0, 0, 100, 100); Graphics Drylips (MyPain, 0, 0, 100, 100); myPen.Dispose (); }}

You OnPaint method:

  Text renderer Draw text (graphics, text, font, new point (5, 5), system calculators. Control text);   

Where new dot (5, 5) - is the top spot of the text.

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 -