Detailed explanation of common properties and events of C # button form


1. Common attributes

  • Name: name;
  • Backcolor: set the background color of the control;
  • Enabled: whether it is available or not;
  • Flaystyle: control style;
  • Image: set the control image;
  • Imagealign: image alignment;
  • Imagelist: image Imagelist index value;
  • Location: coordinate;
  • Size: size;
  • TabIndex: control order index;
  • Text: text;
  • Textalign: text alignment;
  • Visible: whether the control is visible;

2. Control events:

  • Click: click an event;

Knowledge point expansion:

In the real C # development scenario, we only use the name attribute, text attribute and click event of the button to use the button. Others are rarely used. If you change to another programming language, it’s the same. I also saw other people’s video tutorials about C #. The use of buttons is a mess. Here I simply record how to use the button.

1. Select the button component from the toolbar. Then press the mouse in the design area to drag out the shape of a button.

2. In the design attribute group, there is a name attribute, which is equivalent to the name attribute of easy language and is used in code writing. It’s very easy to use this if you have experience in developing easy language. For example, we changed it to Chinese: button_ determine.

3. Modify the text attribute in the shape attribute group, which is equivalent to the title attribute of easy language. For example, it is revised to be “OK”. After the modification is completed, remember to press enter and the modification will be successful.

4. Add a click event. In the attribute area, there is a lightning icon. After you click it, you will enter the list of events. In this event list, we select the click event and press enter to enter the click event code of the button.

The above is the details of the common properties and events of C # button form. For more information about the knowledge points of C # button form, please pay attention to other related articles of developer!