file · Web viewMicrosoft Visual Studio is a programming environment used to create...

27
Application Programming in .NET Learning Outcomes: 1. Explain critically the concepts of the .NET framework. 2. Design, implement and test programs in the C# language. 3. Apply OO techniques in developing Windows-based programming applications. 4. Construct new classes to add additional functionality to the foundation classes available in the programming language used

Transcript of file · Web viewMicrosoft Visual Studio is a programming environment used to create...

Page 1: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

Application Programming in .NETLearning Outcomes:

1. Explain critically the concepts of the .NET framework.2. Design, implement and test programs in the C# language.3. Apply OO techniques in developing Windows-based programming applications.4. Construct new classes to add additional functionality to the foundation classes available

in the programming language used

Page 2: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

Lab 1:

Introduction to Microsoft Visual C#    Startup

Microsoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems. To use these lessons, you must have installed either Microsoft Visual C# 2010 Express Edition or Microsoft Visual Studio 2010. To get Microsoft Visual C# 2010 Express Edition, you can download it free from the Microsoft web site. After downloading it, you can install it.

From now on, unless specified otherwise, we will use the expressions Microsoft Visual C# 2010 Express Edition or Microsoft Visual Studio 2010.

After installing it, to use Microsoft Visual Studio, you must launch it. You can do this by clicking Start -> (All) Programs -> Microsoft Visual C# 2010 Express Edition or Start -> (All) Programs -> Microsoft Visual Studio 2010 -> Microsoft Visual Studio 2010:

Page 3: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

The Microsoft Visual Studio InterfaceMicrosoft Visual Studio presents itself as a series of tools used to assist you in creating computer programs. As a normal Windows application, it starts on top with a menu and some toolbars. It is also equipped with various windows, considered as tools, you will be using. Most of these tools are available or are functional only if you have primarily created or opened a project.

Application: Starting Microsoft Visual Studio To launch Microsoft Visual Studio:

If are using Microsoft Visual C# 2010 Express, on the taskbar, click Start -> (All) Programs -> Microsoft Visual Studio 2010 Express -> Microsoft Visual C# 2010 ExpressIf you are using Microsoft Visual Studio 2010, on the task bar, click Start -> (All) Programs -> Microsoft Visual Studio 2010 -> Microsoft Visual Studio 2010

The ToolbarsA toolbar is an object made of buttons. These buttons provide the same features you would get from the (main) menu, only faster. Under the main menu, the Integrated Development Environment (IDE) is equipped with the Standard toolbar.

By default, when you start Microsoft Visual Studio, it is equipped with one toolbar: Standard. To get more toolbars, on the main menu, you can click View -> Toolbars and click the toolbar of your choice. You can also right-click any available toolbar or the main menu. This displays a list of all the available toolbars. Those that are currently opened have a check mark next to them.

A toolbar is equipped with buttons. To know what a button is used for, you can position the mouse on top of it. A tool tip will come up and display for a few seconds. In our lessons, each button on any toolbar will be named after its tool tip. This means that, if a tool tip displays "New", its button will be called the New button.

Microsoft Visual Studio's menus and toolbars can be customized. You can customize a menu category on the main menu by adding a menu item to it. You can customize a toolbar by adding a button to it. To start, right-click anything on the main menu or on any toolbar and click Customize... For example, imagine you want to add an item named Start Without Debugging so that it would let you easily execute your projects and you want to add its button to the Standard toolbar, and imagine you want to position it on the left side of the Start button:

To proceed:

a. You can right-click any button on any toolbar or right-click the main menu and click Customize

b. On the Customize dialog box, click the Commands tabc. Click the Toolbars radio button

Page 4: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

d. In the right combo box, select the toolbar to which you want to add a button. In this case, that would be Standard

e. In the Controls list, click the button that will succeed the one you want to add. In this case, this would be Start / Continue:

f. In the right list, click Add Commandg.  In the Add Command dialog box, in the Categories list, select the category that

has the button you want. In this case, that would be Debugh.  In the Commands list, click the button or menu item you want. For our example,

that would be Start Without Debugging

Page 5: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

i. After makiing the selection, click OK

Page 6: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

j. On the Customize dialog box, click Close:

In the same way, you can customize any toolbar and any menu category.

The Studio Windows The Start Page

The Start Page is the first wide area that appears when Microsoft Visual Studio comes up. The left section displays a list of recently used projects under Recent Projects. At any time, to display the Start Page:

Page 7: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

You can click the Start Page label in the top section of the Code Editor On the main menu, you can click View -> Start Page

If you have just installed Microsoft Visual Studio or have not previously opened a project, the Recent Projects section would be empty. Once you start creating and using projects, they display in the Recent Projects section by their names.

Showing and Closing a WindowWhen you start or open a project, Microsoft Visual Studio makes some windows available. These are the most regularly used windows. If you think that one of them is not regularly used in your types of assignments, you can remove it from the screen. To hide a window, you can click its Close button  .

All of the windows you can use are listed in the View menu. Therefore, if a window is not displaying, you can click View on the main menu and click a window of your choice.

Practical Learning: Showing the Windows1. On the main menu, click View -> Solution Explorer2. Again, on the main menu, click View -> Toolbox

Auto Hiding a WindowWhen working on a project, you will use a set of windows that each accomplishes a specific purpose. Some windows are represented with an icon but hide the rest of the body. To display such a window, you can position the mouse on it. This would expand the window:

Page 8: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

If you expand a window, it would display a title bar with three buttons. One of the button is called Auto Hide:

If you expand a window but find out you don't need it any more, you can just move the mouse away. The window would return to its previous state. Based on this functionality, if you are working with a window and move the mouse away, it would retract. If you need it again, you would have to reopen it using the same technique. If you are going to work with a certain window for a while, you can keep it open even if you move the mouse away. To do this, you can click the Auto Hide button. If clicked, the Auto Hide button changes from pointing left to pointing down:

Page 9: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

By default, Microsoft Visual Studio installs some windows to the left and some others to the right of the screen. You can change this arrangement if you want. To do this, expand a window, then click its title bar and start dragging. While you are dragging, to assist you with a new position, the studio displays five boxes:

Page 10: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

Docking a Window to a Side of the StudioTo position a window on one side of the screen, drag its title bar to the box that represents that side. When you get to a side, a transparent blue rectangle would be drawn to indicate the possible position. Drop the window to either the most right guiding box to position it to the right of the screen, or to the most left guiding box to position it to the left of the screen. Here is an example:

Page 11: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

or

Page 12: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

To position a window to the top or the bottom side of the studio, drag its title bar to either the most top guiding box to position it to the top of the studio or to the most bottom guiding box to position it to the bottom of the studio. Here is an example:

Page 13: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

Docking a Window Above or Below AnotherTo make two windows share an area, you can position one above or below an existing window. Of course, you must first have a window as reference. Then, drag the second window to the existing window. Drop it in the

This

Page 14: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

Becomes

Page 15: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

 Or this

Page 16: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

Becomes

Page 17: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

Floating WindowsMost of the windows you will use are positioned on one side of the screen. If you want, you can have a window that stays on top of other windows but is not "glued" to one side. Such a window is said to float. To float a window, drag its title bar and release it somewhere in the middle of the screen but not on a guiding box.

When a window is floating, it displays a Maximize button   on the title bar. If you click this button, the window occupies the whole interface of Microsoft Visual Studio. In the same way, if you double-click the title bar, the window gets maximized.

If a window is currently floating and you want to dock it, right-click its title bar and click Dock:

Page 18: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

If a window is currently docked and you want to float it, right-click its title bar and click Float.

Coupling WindowsYou can make two or more windows share one side of the screen or to share an area. To do this, first expand and dock the window that you will use as the base (or reference). Then, drag the title bar of the window that will share the area to its target until the bottom part of the base window shows a highlighted and a non highlighted area:

Page 19: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

Then release the mouse:

Page 20: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

To remove a window that shares an area, drag its tab away:

Page 21: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

To position a window to the left or the right of an existing window, first drag the second window to where the existing window is. Then click the left or the right guiding box of the multiple-box.

This

Page 22: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

becomes this

Page 23: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

 In the same way, you can make two or more windows share the same area.

Tabbed WindowsYou can make a window display its tab in the top section of the Code Editor and share the area with it. There are two ways yon do it

You can drag a window and drop it on the tab of the Start Page.This

Page 24: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

becomes this

Page 25: file · Web viewMicrosoft Visual Studio is a programming environment used to create graphical user interface (GUI) applications for the Microsoft Windows family of operating systems

If a window is already represented with a tab on top of the Code Editor, you can drag the second window and drop it to the left or of the right tab of the existing window.

You can right-click Dock as Tabbed Document