Presentation is loading. Please wait.

Presentation is loading. Please wait.

Creating a Windows Forms User Interface

Similar presentations


Presentation on theme: "Creating a Windows Forms User Interface"— Presentation transcript:

1 Creating a Windows Forms User Interface
Lesson 3

2 Objectives

3 Working with Windows Forms
Now that you can create a Windows Forms project and a default Windows Form, you will learn how to modify the default Windows Form’s behavior by setting property values or by using the Windows Forms Design View editor. Once you can create and modify one Windows Form, you learn how to add and modify additional Windows Forms to create a Multiple Document Interface (MDI).

4 Properties Window As one of the few activities that do not require coding, you can modify the appearance of Windows Forms by using the Properties window.

5 Common Windows Forms Properties
ControlBox FormBorderStyle Icon Location ShowIcon ShowInTaskbar StartPosition Size Text TopMost WindowState

6 Adding Multiple Windows Forms
Using the Add New Item dialog, you can add multiple Windows Forms to your application. You can organize multiple Windows Forms into a Single Document Interface (SDI) or a Multiple Document Interface (MDI).

7 Creating Windows Forms Inheritance
You can instantiate new Windows Forms from other Windows Forms. You can inherit new Windows Forms from other Windows Forms and then extend your inherited Windows Forms to add additional functionality. Instantiating a Windows Form from another Windows Form is performed at run time in code. Inheriting a Windows Form from another Windows Form is performed at design time by using the Add New Item dialog.

8 Extending Inherited Windows Forms
By using Virtual methods in the base Windows Forms class, inherited Windows Forms can Override the methods and extend the base class’s functionality. A Virtual method tells the Windows Forms class that this method will use the base class defined functionality, unless a derived class has an Override method. An Override method is a method declaration that replaces the Virtual method in the base class with new functionality.

9 Inheritance Picker Dialog

10 Windows Forms Controls
When designing a Windows Forms Application, there are various Windows Forms Controls that can be used to create a functional user interface. The challenge is to select and organize the right Windows Forms Controls to perform your application’s desired result.

11 Windows Forms Controls
While implementing a Windows Forms Application, you will need to work with several types of controls, including: Container controls Menus and Toolbars controls Basic Input controls Advanced Input controls Component controls Dialog controls Controls can be combined in multiple ways to create the desired user interface.

12 Container Controls Dividing up a Windows Form’s Graphical User Interface (GUI) into manageable areas can be accomplished using container controls. Container controls group other controls together and provides a more organized user interaction.

13 Menus and Toolbars Control
It is very common in a Windows Forms Application to add navigation functionality in the form of menus and toolbars. Menus and Toolbars controls are a special category of container controls that only hold Menu and Button controls.

14 Windows Forms Menus and Toolbars Controls
MenuStrip creates a system of menus and sub-menus for the user to navigate the functionality of an application. ContextMenuStrip has all of the same features as the MenuStrip control, with the exception that the ContextMenuStrip control does not automatically appear when the application runs. To make the ContextMenuStrip control visible, you must use the Show method.

15 Windows Forms Menus and Toolbars Controls
ToolStrip creates a toolbar of ToolStripButton controls to access application functionality. ToolStripContainer holds multiple ToolStrip controls. StatusStrip creates a Status toolbar that can contain multiple ToolStripStatusLabel controls.

16 Input Controls Gathering inputs from a user during the execution of your application can be a vital function. You will also work with input controls that will be grouped into two categories: Basic Input Controls: Controls that have a specific functionality with several common properties and methods. Advanced Input Controls: Controls that have multiple functionalities with unique properties and methods.

17 Windows Forms Design View Editor
As an alternative to changing property values in the Properties window, Visual Studio provides you with a What You See Is What You Get (WYSIWYG) editor. The Windows Forms Design View editor provides you with a real-time view of how your application’s user interface will appear at run time. Using the Windows Forms Design View editor, you can perform the following: Move controls Resize controls Align controls

18 Basic Input Controls Visual Studio provides a set of controls that all have a common set of properties and methods. These Basic Input controls are used to build basic functionality in your application’s user interface.

19 Basic Input Controls All Input Controls - Several properties that apply to all of the Basic Input controls. Label - A read-only text area you use to provide information to the user. TextBox - A read/write text area. ListBox - A set of rows where each row contains a piece of information. ComboBox - A TextBox and ListBox control. CheckBox - A Label control with a CheckBox control. RadioButton - A Label control with a round (Radio) CheckBox control. Button - A Label control inside of a Button control.

20 Advanced Input Control
Each Advanced Input control typically has very specific functionality and is designed to extend the Basic Input controls. Treeview ListView DateTimePicker CheckListBox MaskedTextBox

21 Component Controls Most component controls extend other controls and provide centralized common functionality. Error Provider Help Provider EventLog BackgroundWorker

22 Dialog Controls ColorDialog FontDialog FolderBrowserDialog
The Dialog controls provide a centralized functionality for selecting a folder, files, color, or font. Each Dialog control presents the user with an intuitive interface for making an appropriate selection. Dialog Controls include: ColorDialog FontDialog FolderBrowserDialog OpenFileDialog SaveFileDialog

23 Windows Forms Control Library
You use the Windows Forms Control Library Template to create a default custom control. The Windows Forms Control Library creates a default custom control with a blank control area and the inherited properties and methods from the Windows.Forms.UserControl class. You will need to add more properties and methods to give your custom control more functionality.

24 Inheriting a Custom Control Library
New custom user controls can be created from existing controls by using inheritance. When you create a custom user control based on an already existing control, you can extend the base control to create a new custom user control. Custom user controls support standard inheritance declarations. Depending on how the base control was declared and created, a new customer user control can override or extend existing functionality.

25 Summary You learned how to create a Windows Forms Application and modify its properties using the Properties window. You learned how to inherit a Windows Form based on another Windows Form. You learned how to create a Windows Forms control, arrange the Windows Forms control on the Windows Forms area using the Properties window and the Design View editor, and modify various Windows Forms controls properties and methods to demonstrate most controls’ functionality.

26 Summary You learned how to create a Custom User Control and add other controls to create a new control. You learned how to inherit a Custom User Control and override the derived controls’ functionality.


Download ppt "Creating a Windows Forms User Interface"

Similar presentations


Ads by Google