Summary
C# and Visual Studio are designed to create Windows applications with visual design tools that enable you to drag-and-drop controls onto a form.
The application window itself is called a form, and the items that you drag onto the form are known as controls.
Windows applications use an event-driven design, meaning that the application responds to events raised by the user or the system, and most of your code will reside in event handlers.
Windows automatically provides the code to initialize the form and the controls; you don’t need to write any of it.
The Properties window allows you to change the properties of a control without having to edit the code by hand.
The Events window (available from a button in the Properties window) helps you to create event handlers for all the possible events for your control. Simply double-click the event, and Visual Studio will create a skeleton event handler and then take you to the appropriate point in the code, so you can enter your logic.
You can double-click a control itself to have Visual Studio create the default event handler for that control.
Visual Studio divides the Design view of the form from the code page, where the code for the event handlers is kept.
The
partialkeyword in the class definition indicates that Visual Studio is hiding the initialization code for the form and the controls. The partial class file is where you keep your event handler code.Windows has a number of built-in classes and methods that you can use to control ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access