c# - How to make a manually created button invisible after it is clicked in Windows Form? -


Manually created a button using the code below, usually with the button I have my visible = false to invisible, which I do in the setInvisible method when I click the button. I can not do this manually with the built-in button, though?

  myButtonObject start = new myButtonObject (); Public mainstream () {Initial group (); 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 "; This.Controls.Add (start); } Zero start_Click (object sender, System.EventArgs e) {start.Visible = false; SetInvisible (); // sets a set of invisible set buttons; // Set sets another group} Public class myButtonObject: UserControl {// New button Draw. 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); Text renderer Dave Text (Graphics, "Start", New Font ("Ariel Black", 12.25F, System. Drawing. FONT City. BOLD), New Point (23,37), SystemCollars.Control Text); myPen.Dispose (); }    

You can create your manually created button field , outside the constructor :

  start mybuttonObject private;   

Something like that

  public class mainframe () // // in any property // button declaration as a field to access it Do class private myButtonObject start / method / creator; ...} Public MainForm () {InitializeComponent (); 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); This.Controls.Add (start); ...} private void setInvisible () {... // You can use the button within the setInvisible () method. View = false; }    

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 -