If you want to add a control to a form, you can use the Toolbox on the left of Visual Studio. Move your mouse over to the Toolbox, and click the plus symbol next to Common Controls. You should see the following list of things that you can add to your form:
Click the Button item under the Common Controls heading. This will select it. Now click once anywhere on your form. A button will be drawn for you, and your Form will look like this:
Now look in the bottom right of Visual C# Express, just below the Solution Explorer. You should see the Properties Window (if it's not there, select it from the View menu at the top. Again, 2010 users need to click Tools > Settings > Expert Settings to see the full list of menu items.):
From this window you can customize the button according to your need
To view the list of Properties in alphabetical order, click the AZ symbol at the top of the property window.
As you can see, there's a lot of Properties for a button. Scroll down to the bottom and locate the Text Property:
The Text Property, as its name suggests, is the Text you want to appear on the button. At the moment, it says button1. Click inside of the text area of button1. Delete the default text:
Now type the following:
Message
The Text part of your Properties Window will then look like this:
Now press the enter key on your keyboard. Have a look at your Form, and the Text on the button should have changed:
In next session i will tell you how to write events in code behind file.
Happy Programming..:)
Toolbox |
Click the Button item under the Common Controls heading. This will select it. Now click once anywhere on your form. A button will be drawn for you, and your Form will look like this:
Form |
Similarly you can drag and drop different controls on the Form According to your requirements.
The text on the button, which defaults to "button1", can be changed from properties windows.
A property of a control is things like its Height, its Width, its Name, its Text, and a whole lot more besides. To see what properties are available for a button, make sure the button is selected, as in the image below:
Now look in the bottom right of Visual C# Express, just below the Solution Explorer. You should see the Properties Window (if it's not there, select it from the View menu at the top. Again, 2010 users need to click Tools > Settings > Expert Settings to see the full list of menu items.):
From this window you can customize the button according to your need
To view the list of Properties in alphabetical order, click the AZ symbol at the top of the property window.
As you can see, there's a lot of Properties for a button. Scroll down to the bottom and locate the Text Property:
The Text Property, as its name suggests, is the Text you want to appear on the button. At the moment, it says button1. Click inside of the text area of button1. Delete the default text:
Now type the following:
Message
The Text part of your Properties Window will then look like this:
Now press the enter key on your keyboard. Have a look at your Form, and the Text on the button should have changed:
In next session i will tell you how to write events in code behind file.
Happy Programming..:)
can we change shape of buttons?
ReplyDeleteYes we can change the shape of buttons in WPF not in simple window form application.
ReplyDeleteWPF? what is this?
ReplyDelete