New version page

Creating Windows Applications in Visual Studio

Upgrade to remove ads

This preview shows page 1-2-3-4-5 out of 14 pages.

Save
View Full Document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience

Upgrade to remove ads
Unformatted text preview:

Creating Windows Applications in Visual Studio .NET Using C#v0.2a, JL Popyack, Feb. 2004 (Revised July 2004)Find and open Visual Studio .NET. This should take you to the Start Page. If your screen does not show the "Solution Explorer" visible (as shown here on the right side), select View->Solution Explorer to make it visible. (In Visual Studio .NET, a "Solution" is a collection of files comprising source code and libraries to be compiled and linked. To Create a New Project with C#: You will use a project template to create your project. As the online help explains, “a project template creates the initial files, references, code framework, property settings, and tasks appropriate for the selected project.” To do this, select "File->New->Project…", which should bring up the following dialog:Prepared for "Developing Software for the Tablet PC", JL Popyack, B Char, N Herrmann: Project DUPLEX, Drexel University, SIGCSE Technical Symposium, Mar.3, 2004. Revised for use by PGSIT, 2004.Since you’re going to create a C# application, choose the “Visual C# Projects” item in the left pane, and choose the “Windows Application” item in the right pane. Type in a name for your application – in this example, we have chosen “MyWindowsApplication” as a name – then click “OK”. A new solution should be created for you. This will take a few moments. The default location for Visual Studio.NET projects is in your “My Documents” folder, in a subfolder called “Visual Studio Projects”. Prepared for "Developing Software for the Tablet PC", JL Popyack, B Char, N Herrmann: Project DUPLEX, Drexel University, SIGCSE Technical Symposium, Mar.3, 2004. Revised for use by PGSIT, 2004.When setup is completed, the application space should look like this:Prepared for "Developing Software for the Tablet PC", JL Popyack, B Char, N Herrmann: Project DUPLEX, Drexel University, SIGCSE Technical Symposium, Mar.3, 2004. Revised for use by PGSIT, 2004.The Solution Explorer at the right shows the files that have been added, which are needed for your application. The file Form1.cs as shown in this picture contains code necessary to produce a window called Form1, which looks like the form shown in the left pane. The left pane shows the Design View of the form, which is why the tab above it says “Form1.cs [Design]”. There are some icons at the top of the Solution Explorer window, just below the title bar. To see the code that produces this window, select the leftmost one (if you place the cursor above this icon, the words “View Code” appear, as shown in the screen view below). Clicking the icon causes a window to appear that shows the C# code used to produce the formPrepared for "Developing Software for the Tablet PC", JL Popyack, B Char, N Herrmann: Project DUPLEX, Drexel University, SIGCSE Technical Symposium, Mar.3, 2004. Revised for use by PGSIT, 2004.A new tab labeled “Form1.cs” has appeared for the window containing the actual C# code. Scrolling through the code shows a few interesting features of the Visual Studio .NET/C# environment: - There are little boxes next to some lines of code that have “-” in them. Clicking on one of those will collapse a section of the code, so that it may be hidden when you aren’t interested in looking at it. For instance, click thebox next to Line 35. This should cause lines 35-46 to collapse with only the header line for the Dispose() routine still visible (and a “+“ sign in the box.)- [section deleted, “Creating Online Documentation”]You can return to Design View either by clicking the “View Design” icon next to the “View Code” icon in the Solution Explorer window, or by clicking the “Form1.cs [Design]” tab in the left pane. Prepared for "Developing Software for the Tablet PC", JL Popyack, B Char, N Herrmann: Project DUPLEX, Drexel University, SIGCSE Technical Symposium, Mar.3, 2004. Revised for use by PGSIT, 2004.- Notice that some of the code bears the designation “Windows Form Designer generated code”. This code has been generated automatically from the Form Designer window. To see the effects of this, find line 47 in the Code window, and click the “+” next to it. Several lines are made visible, including the following:private void InitializeComponent(){// // Form1// this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);this.ClientSize = new System.Drawing.Size(292, 266);this.Name = "Form1";this.Text = "Form1";}Now go back to Form Designer view, click on the form, and resize the form by dragging one of the resizing boxes. Prepared for "Developing Software for the Tablet PC", JL Popyack, B Char, N Herrmann: Project DUPLEX, Drexel University, SIGCSE Technical Symposium, Mar.3, 2004. Revised for use by PGSIT, 2004.After resizing, go back to Code view and examine the lines of code generated by this form. You should find theline corresponding to form size has been altered.Prepared for "Developing Software for the Tablet PC", JL Popyack, B Char, N Herrmann: Project DUPLEX, Drexel University, SIGCSE Technical Symposium, Mar.3, 2004. Revised for use by PGSIT, 2004.To add more GUI items to your application, click the “Toolbox” in the left margin of the application window. (If the Toolbox is not visible, select View->Toolbox) A set of applicable choices appears. [NOTE: Make sure you are in Design view. If you are in Code view, a very different set of choices appears.]To add a button, click Button and while holding the mouse button depressed, drag it to the form. Prepared for "Developing Software for the Tablet PC", JL Popyack, B Char, N Herrmann: Project DUPLEX, Drexel University, SIGCSE Technical Symposium, Mar.3, 2004. Revised for use by PGSIT, 2004.You may resize and reposition the button by clicking on it and/or dragging.Prepared for "Developing Software for the Tablet PC", JL Popyack, B Char, N Herrmann: Project DUPLEX, Drexel University, SIGCSE Technical Symposium, Mar.3, 2004. Revised for use by PGSIT, 2004.You can modify an object’s properties by clicking on it, right-clicking, and selecting “Properties” from the pop-up menu. An assortment of properties and their values appears.Change the text that appears in the button by selecting the item next to Text in the Properties window, and typing the desired text.Prepared for "Developing Software for the Tablet PC", JL Popyack, B Char, N Herrmann: Project DUPLEX, Drexel University, SIGCSE Technical Symposium,


Download Creating Windows Applications in Visual Studio
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Creating Windows Applications in Visual Studio and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Creating Windows Applications in Visual Studio 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?