Working with WinForms - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Working with WinForms

Description:

Class libraries are divided into namespaces. Namespaces group ... Activated, Closed, Closing, Deactivate, Load. Text, BackColor, ForeColor, Font. ActiveForm ... – PowerPoint PPT presentation

Number of Views:55
Avg rating:3.0/5.0
Slides: 25
Provided by: hem48
Category:

less

Transcript and Presenter's Notes

Title: Working with WinForms


1
Chapter 2
Working with WinForms
2
Objectives
  • Explain Class Libraries
  • Explain the concept of properties and events
  • Explain the event handling concepts
  • Work with basic interface components

3
Application

Application
User Interface
  • Program

4
Introduction to Class Libraries
  • .Net Framework is based on OO approach.
  • Class library is a collection of reusable
    classes or types.
  • Class libraries are divided into namespaces.
  • Namespaces group classes according to their
    common services.

Example System.Windows.forms
5
Properties and Methods
Class
Frog
Object
Instance of the class
Height Weight Name
properties
Height 12 cm Weight 100gm Name Jumpie
method
Jump
6
Events and Event Handlers
  • The interaction between various objects
    within the application, and between the
    objects and external entities is facilitated
    through Events and Event Handlers.

EVENT HANDLING
Event handler
Event
7
Event Handling Example
Event
When Save Clicked() Display Message(Save
Button) When Print Clicked() Display
Message(Print Button)
Event Handler
User Interface
User action clicking the button
8
User Interfaces
Features of good user interfaces
  • Easy to learn
  • Easy to use
  • Attractive

Type of user interfaces
Character based
GUI based
9
Windows Application
The basic unit is a form
Uses of a Form ???
  • Presents information to the user
  • Receives information from the user

An application can have multiple forms
10
WinForms GUI (1)
  • Form is represented as a class in WinForms.
  • Whenever an application is created, a form is
    added.
  • WinForms create an instance of the Form class.
  • In WinForms, properties and methods of the
    classes are classified as shared and instance
  • types.

11
WinForms GUI (2)
  • Shared properties deal with multiple instances of
    the same class.
  • Instance properties are assigned for each
    instance of the class.
  • Properties and methods of the form can be
    set or read in any of the following ways

WindowsApplication1.Form1.EnabledTrue
Form1.EnabledTrue
12
Form Properties, Methods and Events
13
Controls
  • Form object has many Visual Interface Components.
  • Visual Interface Components are collectively
    known as Controls.

Example textBox1.EnabledTrue this.textBox1.Enabl
edTrue
14
Some Common Properties of Controls
15
Different Controls
  • Label
  • TextBox
  • Button
  • ListBox
  • CheckedListBox
  • ComboBox

16
Label
PROPERTIES
Methods
Image
Hide
Show
TabStop
Update
Events
Paint
17
TextBox
Methods
PROPERTIES
AcceptReturn
AppendText
Clear
ReadOnly
Paste
Passwordchar
Cut
MaxLength
Events
Copy
Multiline
TextChanged
ScrollBars
MultilineChanged
18
Button
PROPERTIES
Methods
DialogResult
PerformClick
TextAlign
Events
Click
19
ListBox 1
PROPERTIES
Items
SelectedItems
MultiColumn
Sorted
SelectedIndex
SelectedValue
SelectedItem
Text
20
ListBox 2
Events
Methods
ClearSelected
SelectedIndexChanged
GetSelected
SelectedValueChanged
FindString
SetSelected
21
CheckedListBox
PROPERTIES
Methods
SetItemChecked
CheckedIndices
GetItemChecked
ThreeDCheckBoxes
GetItemCheckState
CheckedItems
Events
SetItemCheckState
ItemCheck
22
ComboBox
Methods
PROPERTIES
Select
DropDownStyle
SelectAll
Focused
MaxDropDownItems
Events
DropDown
23
Some Form Components
  • Identify the control components

24
The this keyword
  • Represents the current active form.
  • All properties, methods, events of the form can
    be accessed.

Example this.controlname.propertyname
Write a Comment
User Comments (0)
About PowerShow.com