0% found this document useful (0 votes)
4 views8 pages

Class Notes Unit 3

The document provides an overview of Graphical User Interfaces (GUIs) and introduces Visual Studio .NET as an Integrated Development Environment for creating desktop applications using Windows Forms. It covers key features, components, event handling, and various controls available in Windows Forms, including buttons, textboxes, and menus. Additionally, it discusses advanced topics like MDI forms and user-defined controls for customized functionality.

Uploaded by

frencita
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views8 pages

Class Notes Unit 3

The document provides an overview of Graphical User Interfaces (GUIs) and introduces Visual Studio .NET as an Integrated Development Environment for creating desktop applications using Windows Forms. It covers key features, components, event handling, and various controls available in Windows Forms, including buttons, textboxes, and menus. Additionally, it discusses advanced topics like MDI forms and user-defined controls for customized functionality.

Uploaded by

frencita
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1. What is a Graphical User Interface (GUI)?

A Graphical User Interface (GUI) allows users to interact with software using visual elements like
windows, buttons, textboxes, menus, icons, etc.
Rather than typing commands, users click and interact with these elements.

Windows Forms is a part of .NET Framework used to create desktop GUI applications.

2. Introduction to Visual Studio .NET

Visual Studio .NET is an Integrated Development Environment (IDE) from Microsoft that makes
software development easy.

Key Features

• Code editor with IntelliSense

• Designer for drag-and-drop UI creation

• Debugging tools

• Project templates

• Event handling support

Components of Visual Studio

1. Toolbox – Contains UI controls (buttons, textboxes, etc.)

2. Solution Explorer – Shows files and project structure

3. Properties Window – Displays properties of controls

4. Form Designer – Drag-and-drop area for designing GUI

5. Code Editor – Write logic and event handlers

6. Output Window – Shows build/run messages

3. Introduction to Windows Forms

• Windows Forms is a library in .NET for creating desktop applications.

• Each form is a window where UI controls are placed.

• Forms respond to user actions (like clicks) using event handling.


4. Event Handling

In GUI, actions such as clicking a button or typing text trigger events.

Event Driven Programming

• Code runs in response to user actions.

• Example: Clicking a button triggers a Click event.

Basic steps in event handling:

1. Place a control (e.g., Button)

2. Double-click it → generates an event method

3. Write code inside that method

Example:

private void btnClickMe_Click(object sender, EventArgs e)

[Link]("Button Clicked!");

5. Simple Event Driven GUI

A form with:

• Label

• Textbox

• Button

6. Control Properties & Layout

Every control has properties such as:

• Text — content shown

• Name — variable used in code

• Size — height and width

• Location — position on form


• BackColor / ForeColor — color settings

7. Anchoring & Docking

These properties control how controls behave when the form resizes.

Anchoring

• Binds a control to edges of the form.

• Example: TextBox anchored to Top, Left, Right will stretch horizontally when form resized.

Docking

• Attaches a control to one side or fills entire form.

• Example: A panel docked Top always stays at top.

8. Windows Form Controls

Basic Controls

Here are key controls with purpose:


Label

• Displays text.

• Not interactive.

TextBox

• User can enter text.

Button

• Clicking triggers action (event).

9. GroupBox & Panel

Both are container controls.

GroupBox

• Puts related controls in a bordered box.

• Useful for grouping Radio Buttons.

Panel

• A flexible container.

• Used for custom layouts (scrollable).


10. CheckBox

Allows multiple selections.


Example: Select hobbies.

if([Link])

// do something

11. RadioButton

Only one option selectable within a group.

Used with GroupBox for exclusivity.

12. PictureBox

Displays images (JPEG, PNG)

Properties:

• Image

• SizeMode (Stretch, Zoom, Center)

13. Tooltips

• Shows text when hovering over a control.

• Improves usability.

[Link](btnSubmit, "Click to submit");

14. NumericUpDown Control

✔ Allows numeric input with up/down arrows.


Good for integers (age, quantity).
15. Mouse & Keyboard Event Handling

Controls can respond to:

Mouse Events

• Click

• MouseEnter, MouseLeave

• MouseMove, MouseDown

Example:

private void btn_MouseEnter(...) { … }

Keyboard Events

• KeyDown

• KeyPress

• KeyUp

Use when responding to keys typed.

16. Menus

Menus allow navigation.

MainMenu / MenuStrip

• File, Edit, Help menus

• Click action handled by events

Example:

File → New, Open, Exit

17. Other Controls

MonthCalendar

Graphical calendar allowing date selection.

DateTimePicker

Select a single date/time value.


LinkLabel

• Similar to label.

• Contains hyperlink styled text.

• Clicking opens URL or triggers event.

ListBox

Displays list; allows single/multiple selection.

CheckedListBox

List where each item has a checkbox.

ComboBox

Dropdown list; allows selection from items.

18. Creating MDI Forms

MDI = Multiple Document Interface

Concepts

• MDI Parent Form — main container

• MDI Child Forms — multiple child windows inside parent

Used in apps like text editors where multiple docs open simultaneously.

Example Setup

1. Set parent form IsMdiContainer = true

2. Create child forms and set:


[Link] = this; [Link]();

19. User-Defined Controls

When built-in controls aren’t enough:

Custom Control

• You can extend existing controls or combine multiple ones.

• Example: A control with a textbox + button.


Benefits:
✔ Reusability
✔ Customized behavior

Control Purpose

Label Display text

TextBox Input text

Button Trigger action

CheckBox Multiple selection

RadioButton Single choice

PictureBox Display images

ListBox List selection

ComboBox Dropdown

MonthCalendar Calendar layout

DateTimePicker Date picker

You might also like