Computer Science, asked by imrshanif, 1 month ago

name the control of
to execute on its click ​

Answers

Answered by tanishgupta886
0

Explanation:

The Button control represents a standard Windows button. It is generally used to generate a Click event by providing a handler for the Click event.

Let's create a label by dragging a Button control from the Toolbox ad dropping it on the form.

Properties of the Button Control

The following are some of the commonly used properties of the Button control −

Sr.No.Property & Description1

AutoSizeMode

Gets or sets the mode by which the Button automatically resizes itself.

2

BackColor

Gets or sets the background color of the control.

3

BackgroundImage

Gets or sets the background image displayed in the control.

4

DialogResult

Gets or sets a value that is returned to the parent form when the button is clicked. This is used while creating dialog boxes.

5

ForeColor

Gets or sets the foreground color of the control.

6

Image

Gets or sets the image that is displayed on a button control.

7

Location

Gets or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container.

8

TabIndex

Gets or sets the tab order of the control within its container.

9

Text

Gets or sets the text associated with this control.

Methods of the Button Control

The following are some of the commonly used methods of the Button control −

Sr.No.Method Name & Description1

GetPreferredSize

Retrieves the size of a rectangular area into which a control can be fitted.

2

NotifyDefault

Notifies the Button whether it is the default button so that it can adjust its appearance accordingly.

3

Select

Activates the control.

4

ToString

Returns a String containing the name of the Component, if any. This method should not be overridden.

Events of the Button Control

The following are some of the commonly used events of the Button control −

Sr.No.Event & Description1

Click

Occurs when the control is clicked.

2

DoubleClick

Occurs when the user double-clicks the Button control.

3

GotFocus

Occurs when the control receives focus.

4

TabIndexChanged

Occurs when the TabIndex property value changes.

5

TextChanged

Occurs when the Text property value changes.

6

Validated

Occurs when the control is finished validating.

Consult Microsoft documentation for detailed list of properties, methods and events of the Button control.

Example

In the following example, we create three buttons. In this example, let us −

Set captions for the buttons

Set some image for the button

Handle the click events of each buttons

Take following steps −

Drag and drop a Label control on the form.

Set the Text property to provide the caption "Tutorials Point".

Drag and drop three buttons on the form.

Using the properties window, change the Name properties of the buttons to btnMoto, btnLogo and btnExit respectively.

Using the properties window, change the Text properties of the buttons to Show Moto, Show Logo and Exit respectively.

Drag and Drop another button, using the properties window, set its Image property and name it btnImage.

Similar questions