Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Creating a Project
2
CLAddawe
ES26Lecture SectionC
CLAddawe
ES26Lecture SectionC
CLAddawe
ES26Lecture SectionC
CLAddawe
ES26Lecture SectionC
In Visual Studio, programs under development are typically called projects or solutions
Because they contain many individual components (not just one file)
Microsoft Visual Studio Integrated Development Environment (IDE) Menus, tools, component windows (tool windows)
Menu bar Standard toolbar Designer (Form Window) Solution Explorer Properties window Toolbox *Code editor window
CLAddawe
ES26Lecture SectionC
Menu bar - provides access to most of the commands that control the development environment Standard Toolbar a collection of buttons that serve as shortcuts for executing commands and controlling the Visual Studio IDE
Designer
user i interface or f f form; acts as a container for Controls to be used in the application.
CLAddawe
ES26Lecture SectionC
Solution Explorer
An A area of the IDE that f h h contains your solution Helps you manage your project files. The files are displayed in a hierarchical view, much like that of Windows Explorer
Refresh
Properties Window
Used U d to change the characteristics, h h h i i or property settings, of the UI elements o a form A property setting is a quality of one of the objects in your program Changing properties:
Design time (Properties window) Run time (Code Editor)
CLAddawe
ES26Lecture SectionC
Object list- itemizes all the UI elements (objects) on the form Properties list Property settings
Toolbox
a container f all the i for ll h controls
CLAddawe
ES26Lecture SectionC
Toolbox Tabs
Tab Name All Windows Form Common Controls Containers Description Contains all the standard Windows Forms controls that are available in the Toolbox. Contains the most common controls that are typically used in Windows-based pp applications. Contains controls that hold other controls, such as GroupBox controls and Panel controls. Containers can help isolate a set of controls from other controls on the form. Contains controls that enable you to create menus and toolbars for your application, such as the MenuStrip and ToolStrip controls. Contains controls that help you easily work with data in your application, such as the DataGridView control. Contains components that typically do not have a user interface, such as the Timer and the ErrorProvider. Contains controls that enable you to provide printing capabilities to an application. Contains controls that let you use common dialog boxes in your application, such as the SaveFileDialog, FolderBrowserDialog and FontDialog controls.
18
IDE Features
CLAddawe
ES26Lecture SectionC
19
IDE Features
20
Docking guides
CLAddawe
10
ES26Lecture SectionC
21
22
CLAddawe
11
ES26Lecture SectionC
Terminology (OOP)
23
Control
A tool used to create objects in a VB program (most commonly commonly, objects are created on a form; controls are selected from the toolbox and then drawn on the form Different ways of adding controls to the Form:
By double-clicking (default size) Drag and drop (default size) Click and drag
Terminology (OOP)
24
Object
An element that you create in a VB program with a control in the Toolbox Technically speaking objects are instances of a class that supports properties, methods and events Has inherent functionality - they know how to operate and can respond to certain situations on their own (e.g. a list box knows how to scroll)
CLAddawe
12
ES26Lecture SectionC
Terminology (OOP)
25
Class
A blueprint or template for one or more objects that defines what the object does (but is not the object itself) In Visual Basic, you can use existing Visual Studio classes (like System.Math and System.Windows.Forms.Form) and you can build your own classes and inherent properties, methods and events from them
Note: Inheritance allows one class to acquire the pre-existing interface and behavior characteristics of another class
Terminology (OOP)
26
Namespace
A hierarchical library of classes organized under a unique name (e.g. System.Windows and System.Diagnostics) Note: To access the classes and underlying objects within a namespace, place an Imports statement at the top of your program code
CLAddawe
13
ES26Lecture SectionC
Terminology (OOP)
27
Property
A value or characteristic held by an object Setting a property:
Design time using the Properties window Run time using statements in the program code
Object.Property =Value e.g. Label1.Text = Hello! Me.BackColor=Color.Yellow
Event procedure
A block of code that is executed when an object is manipulated in a program
Terminology (OOP)
28
Method
A special statement that performs an action or a service for a particular object in a program Notation:
Object.Method(Value) e.g. Textbox1.Clear() Me.Hide() Listbox1.Items.Add(Check)
CLAddawe
14
ES26Lecture SectionC
Interface Styles
29
Explorer-Style Interface
a single window containing two panes or regions, usually consisting of a tree or hierarchical view on the left and a display area on the right
Interface Styles
30
CLAddawe
15
ES26Lecture SectionC
Interface Styles
31
Interface Styles
32
Explorer-Style Interface
CLAddawe
16
ES26Lecture SectionC
33
Interface Design
Positioning of objects
34
More important elements must be readily apparent to the user Most user's eyes will be drawn to the upper left portion of the screen first.
Organize the user interface so that the information flows either vertically or horizontally, with most important information always located in the upper-left corner of the screen
CLAddawe
17
ES26Lecture SectionC
Positioning of objects
35
The use of white space can help emphasize elements and improve usability
Inconsistency makes your application confusing, chaotic, disorganized and cheap Establish a design strategy and style conventions before you begin development Try to use controls appropriately Keep it simple
CLAddawe
18
ES26Lecture SectionC
Tooltip control
37
Tooltip an object used to provide visual clues to the function of an object f nction
Choosing Fonts
select fonts that will be easily readable at different resolutions and on different types of displays
CLAddawe
19
ES26Lecture SectionC
Use meaningful captions or text in all objects Label each control in the user interface Align the labels and controls in the user interface snaplines Blue and pink snaplines
Naming Objects
40
Must begin with a letter Can contain letters and numbers Cannot contain a period
It is better to prefix a name with letters representing the kind of object they are naming to eliminate confusion especially when the application contains many objects Use meaningful names
CLAddawe
20
ES26Lecture SectionC
41
Class Name
Method Name
CLAddawe
21
ES26Lecture SectionC
Click the Start Debugging button Press F5 Click the Start Debugging command on the Debug menu
Creating an application for Windows (.exe) Two types of files that can be created: yp Debug build
Stored in a folder called bin\debug within the project folder Contains debugging information that makes the program slightly slower
Release build
Stored in a folder called bin\release within the project folder Optimized executable files
CLAddawe
22