Chapter 2: Intro to Visual C# Flashcards
A visual C# application project starts with creating its GUI with:
1) Designer
2) Toolbox
3) Properties window
In the Designer, an empty form is automatically created
1) An application’s GUI is made of forms and controls
2) Each form and control in the application’s GUI must have aname as ID.
Each form and control in the application’s GUI must have aname as ID. The default blank form is named
“Form1” automatically
The default empty form has a dimension (size) of
Pixels wide by pixels high
A form in Designer is enclosed with
Thin dotted lines called the bounding box
The bounding box has small sizing handles; you can use them
To resize the form
The appearance and the other characteristics of a GUI object are determined by
The object’s properties
The Properties window lists all properties
When selecting an object, its properties are displayed in Properties windows
Each property has 2 columns
- Left: Property’s name
- Right: Property’s value
Changing a Property’s Value select an object, such as
The Form, by clicking it once
Click View and select Properties if the Properties window is
Not available
Find the property’s name in the list and change its value
1) The Text property determines the text to be displayed in the form’s title bar
2) Example: Change the value from “Form1” to “My First Program”
Adding Controls to a Form: In the Toolbox, select the Control, then you can either:
- Double click the Button control
- Click and drag the button control to the form
On the form, you can
- Resize the control using its bounding box and sizing handles
- Move the control’s position by dragging it
- Change its properties in the Properties window
Rules for Naming Controls
Control’s names are identifiers of the controls
The naming convention are:
1) The first character must be a letter (lower or uppercase, does not matter) or an undercore
2) All other characters can be alphanumerical characters or underscores
3) The name cannot contain spaces
Creating the GUI for Your First Visual Application Component:
A form and a Button control
Creating the GUI for Your First Visual Application Component purpose:
1) Create the application’s GUI
2) Write the code that causes “Hello World” to appear when the user clicks the button (details are available in)
C# code is primarily organized in three ways:
1) Namespace: a container that holds classes
2) Class: a container that holds methods
3) Method: a group of one or more programming statements that perform some operations
A file that contains program code is called
A source code file
Each time a new project is created the following two source code files are automatically created:
1) Program.cs file
2) Form1.cs file
Program.cs file
Contains the application’s start up code to be executed when the application runs
Form1.cs file
Contain code that is associated with the Form1 form