jagomart
digital resources
picture1_Visual Studio Code Pdf 183597 | Vscsharp


 156x       Filetype PDF       File size 0.60 MB       Source: www.cse.uaa.alaska.edu


File: Visual Studio Code Pdf 183597 | Vscsharp
creating windows forms applications with visual studio and c csce a331 visual studio on a windows platform gives you a multitude of classes to easily create typical windows gui applications ...

icon picture PDF Filetype PDF | Posted on 31 Jan 2023 | 2 years ago
Partial capture of text on file.
        Creating Windows Forms Applications with Visual Studio and C# 
        CSCE A331 
         
        Visual Studio on a Windows platform gives you a multitude of classes to easily create 
        typical Windows GUI applications.  If you elect to use these features, currently a C# 
        application will only run on a Windows machine.  There is similar functionality for C# 
        GUI applications under Mono.  In this lecture we will present just the basics to create 
        some simple Windows apps. 
         
        Although it is possible to create windows applications purely in a textual environment, 
        we will instead make use of the Visual Studio interface which lets us graphically drag 
        and drop to determine the layout of our program.  The VS environment will then generate 
        the necessary code for us to perform the layout. 
         
        The following screenshots were created in VS 2013.  If you have a different version, 
        some windows and/or content may have changed but the basic process is the same.  To 
        create a Windows Forms Application, start Visual Studio and create a new Visual C# 
        Project.  Make sure you select a Windows Application as the template.  
         
                                              
        You will be presented with a blank form.   This document assumes that you have the  
        Toolbox pane visible on the left of the screen and the Properties on the right. These panes 
        can be moved around and hidden.  This pane contains common controls which make up 
        the elements on the form.    The layout is shown below: 
                                              
        A control is a component with a visual representation.  The Control class in the 
        System.Windows.Forms namespace is the base class for the graphical objects on the 
        screen.  All controls are derived from the base control.  Examples of controls include: 
         
                                
         
        A Form is a type of ContainerControl.  It can contain other controls and we can 
        add controls to it.   
         
        In this document we will only discuss a few controls:  Buttons, Labels, TextBox, 
        ProgressBar, and PictureBox.  A Button is just like it sounds, a button we can press and 
        when it is pressed some code is invoked.  A Label is a way to output some text on the 
        form.  A TextBox can be used to output data and provide a way for the user to enter text 
        to the program (although a label is better for data that is purely output only).  A 
        ProgressBar displays a graphical bar of progress for some slow event.  Finally, a 
        PictureBox is used to load and display an image.  Please refer to the VS documentation 
        for details about the other controls. 
         
        Let’s make a simple Windows application that will allow the user to enter a number into 
        a TextBox and press a button.  Upon pressing the button we will output if the number is 
        even or odd into a label. 
         
        First, select the form by clicking on it.  In the Properties Window, you can click and 
        modify various properties of the form.  By default, it is called Form1.   Scroll through 
        the properties; there are many available to change, such as the size, icon, width, locked, 
        etc.  One we can change is the title bar shown with the form.  Here we change the title bar 
        of the form to “Even Odd Tester” by changing the Text property.  
         
                      
        This changes the title of the form itself: 
         
                              
        At this point you may wish to grab the “size” handles around the form, and resize it to the 
        dimensions that you like. 
         
        To add controls to the form, select the control you want from the Toolbox on the left.  
        Then click and drag in the form window in the location you want the control to go.  If 
        you select the Pointer tool, you can select existing items on the form and move them 
        elsewhere.  You can also click and resize the control on the form.   Try dragging a button 
        onto the form: 
         
                               
        Click the button on the form and change its Name property to “btnEvenOdd”.  This is 
        setting the name of the variable used to reference the button object from its default of 
        “Button1”.  Also change the button’s text property to “Even or Odd”.  You should see the 
        change to the text field take place on the form: 
         
                 
        In the same fashion as the button, add a label to the form and name it “lblResult” and set 
        its Text field to “Enter data”. 
         
        Also add a TextBox to the form, name it “txtNumber” and delete the contents of the Text 
        field.  As you add the controls to the form, you will see vertical lines that help you align 
        controls to each other. 
         
        The result should look something like this: 
         
The words contained in this file might help you see if this file matches what you are looking for:

...Creating windows forms applications with visual studio and c csce a on platform gives you multitude of classes to easily create typical gui if elect use these features currently application will only run machine there is similar functionality for under mono in this lecture we present just the basics some simple apps although it possible purely textual environment instead make interface which lets us graphically drag drop determine layout our program vs then generate necessary code perform following screenshots were created have different version or content may changed but basic process same start new project sure select as template be presented blank form document assumes that toolbox pane visible left screen properties right panes can moved around hidden contains common controls up elements shown below control component representation class system namespace base graphical objects all are derived from examples include type containercontrol contain other add discuss few buttons labels t...

no reviews yet
Please Login to review.