400 likes | 547 Views
Visual Studio. Introduction. Visual Studio is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging apps (also called applications) written in various .NET programming languages. Multiple-project solutions are for large-scale apps.
E N D
Introduction • Visual Studio is Microsoft’s Integrated Development Environment (IDE) for creating, running and debugging apps (also called applications) written in various .NET programming languages. • Multiple-project solutions are for large-scale apps. • Most apps we create consist of a solution containing a single project.
Overview of the Visual Studio IDE • A Windows Forms app executes within a Windows operating system (such as Windows 7, Windows 8, and Windows 10) and typically has a graphical user interface (GUI)—users interact with this visual part of the app. • Windows apps include Microsoft software products like Microsoft Word, Internet Explorer and Visual Studio; software products created by other vendors; and customized software that you and other app developers create.
Visual Studio Environment • The Visual Studio environment is where you create and test your projects. In Visual Studio, it is called an • Integrated Development Environment (IDE) consisting of various tools including: • Form Designer • Editor for entering and modifying code • Compiler • Debugger • Object Browser • Help Facility
Menu Bar and Toolbar • Commands for managing the IDE and for developing, maintaining and executing apps are contained in menus, which are located on the menu bar of the IDE • The set of menus displayed depends on what you’re currently doing in the IDE.
Tool Box You can scroll to view more controls. To sort the tools in the toolbox: • Right-click the toolbox and select. • Sort Items Alphabeticallyfrom the context menu (shortcut menu).
Properties Window • To display the Properties window, select VIEW > Properties Window. • The Properties window displays the properties for the currently selected Form, control or file in Design view. • Properties specify information about the Form or control, such as its size, color and position.
Using Help Context-Sensitive Help Visual Studio provides context-sensitive help pertaining to the “current content” (that is, the items around the location of the mouse cursor). To use context-sensitive help, click an item, then press the F1 key. The help documentation is displayed in a web browser window. To return to the IDE, either close the browser window or select the IDE’s icon in your Windows task bar. You can view this help by selecting the Form, clicking its Text property in the Properties window and pressing the F1 key.
Text Box • Allows for user input • Text property • What is displayed in text box • What user entered in text box • TextAlign property • Controls alignment of text in the text box
Group Box • Used as a container for other controls such as radio buttons and check boxes • Improves readability of form by separating the controls into logical groups • Example Names for Group Boxes • ColorGroupBox • StyleGroupBox
Check Box • Allows the user to select or deselect one or more items in any group • Checked property • Checked = True • Unchecked = False • Use the Text property for the text you want to appear next to the box. • Example names for Check Boxes • BoldCheckBox • ItalicCheckBox
Radio Button User may select only one in any group. First create a group box and then create each radio button inside the group box. Checked property Selected = True Unselected = False Text property What is displayed next to the radio button Example Names for Radio Buttons RedRadioButton BlueRadioButton
Picture Box Displays/contains an image Image property Complete path and filename of graphic; it’s a good idea to place the graphic into the folder with your project before it is assigned to a picture box. Can set extension to .bmp, .gif, .jpg, .jpeg, .png, .ico, .emf, .wmf PictureBox controls have several useful properties such as the SizeMode property. StretchImage causes picture to be resized to match the size of the control, or the Visible property, which can be set to False to make the picture disappear
Naming Rules and Conventions • Have a set of standards and always follow them. • No spaces, punctuation marks, or reserved words • Use Pascal casing. • Examples • MessageLabel • ExitButton • DataEntryForm • PaymentAmountTextBox
Modes • Design Time — used when designing the user interface and writing code • Run Time — used when testing and running a project • Break Time — if/when receiving a run-time error or pause error
Planning the Project • Design the user interface. • Set up the form. • Resize the form. • Place a label and a button control on the form using the toolbox. • Lock the Controls in place. • After the user interface is designed, the next step is to set the properties.
Setting the Form Properties • The default startup object is Form1 • The name of the form should always be changed to adhere to naming rules • The properties window shows the files properties
Setting Properties • Label 1 Name MessageLabel Text leave blank • Button 1 Name PushButton Text Push Me • Button 2 Name ExitButton Text Exit • Form Name HelloForm Text Hello World by your name
Setting the Tab Order of Controls (1 of 2) • One control on a Form always has the focus. • Not all control types can receive the focus. • Text boxes, buttons — focus • Picture boxes and labels — no focus • TabStop property is applicable only for controls that are capable of receiving the focus. • Designates whether a control is allowed to receive the focus; set to True or False • TabIndex property determines the order the focus moves as the Tab key is pressed.