The control of the Windows Forms button allows the user to click to execute an action. The Control button can display text as well as images. When you click on the button, it looks like it's pushed in and released. The Click event handler is invoked every time the user clicks a button. To carry out any action you choose, you place code in the Click event handler.
The text shown on the button is included in the property Text
. If your text exceeds the button width, the next line will be wrapped. If the control can not accommodate its overall height, however, it will be clipped. The control button can also display images using the properties of Image
and ImageList
.
The Button Class inherits from the ButtonBase
class directly. Use the mouse, ENTER key, or SPACEBAR to click a button if the focus is on the button.
When we want to change display text of the Button , we can change the Text
property of the button.
If we want to load an Image to a Button control , tehn we can code like this.
Complete Code
We use cookies to ensure you get the best experience on our website, if you continue to browse you'll be acconsent with our Cookies Policy.
Got it!