Chapter 13 Graphical User Interfaces Part 2 Outline

  • Slides: 91
Download presentation
Chapter 13 – Graphical User Interfaces: Part 2 Outline 13. 1 13. 2 13.

Chapter 13 – Graphical User Interfaces: Part 2 Outline 13. 1 13. 2 13. 3 13. 4 Introduction Menus Link. Labels List. Boxes and Checked. List. Boxes 13. 4. 1 List. Boxes 13. 4. 2 Checked. List. Boxes 13. 5 Combo. Boxes 13. 6 Tree. View 13. 7 List. Views 13. 8 Tab Control 13. 9 Multiple Document Interface (MDI) Windows 13. 10 Visual Inheritance 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved. 1

2 13. 1 Introduction • Menu – Presents several logically organized options • Link.

2 13. 1 Introduction • Menu – Presents several logically organized options • Link. Label – Link to several destinations • List. Box – Manipulate a list of values • Combo. Box – Drop-down lists • Tree. View – Display data hierarchically 2002 Prentice Hall. All rights reserved.

3 13. 2 Menus • Menu – Groups related commands – Organize without “cluttering”

3 13. 2 Menus • Menu – Groups related commands – Organize without “cluttering” GUI • Menu items – Commands or options in menu • Sub-menu – Menu within a menu • Hot keys – Alt key shortcuts • Press Alt + underlined letter in desired menu item 2002 Prentice Hall. All rights reserved.

4 13. 2 Menus 2002 Prentice Hall. All rights reserved.

4 13. 2 Menus 2002 Prentice Hall. All rights reserved.

5 13. 2 Menus 2002 Prentice Hall. All rights reserved.

5 13. 2 Menus 2002 Prentice Hall. All rights reserved.

6 13. 2 Menus • Separator bar: -- right click mouse on the menuitem

6 13. 2 Menus • Separator bar: -- right click mouse on the menuitem and select “insert separator” -- typing “-” for the menu text 2002 Prentice Hall. All rights reserved.

13. 2 Menus 2002 Prentice Hall. All rights reserved. 7

13. 2 Menus 2002 Prentice Hall. All rights reserved. 7

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ' Fig 13. 5: Menu. Test. vb ' Using menus to change font colors and styles. Outline Imports System. Windows. Forms Public Class Frm. Menu Inherits Form ' display label Friend With. Events lbl. Display As Label ' main menu (contains file and format menus) Friend With. Events mnu. Main. Menu As Main. Menu ' file Friend menu With. Events mnu. File As Menu. Item With. Events mnuitm. About As Menu. Item With. Events mnuitm. Exit As Menu. Item Menu. Test. vb ' format menu (contains format and font submenus) Friend With. Events mnu. Format As Menu. Item ' color submenu Friend With. Events mnuitm. Color As Menu. Item mnuitm. Black As Menu. Item mnuitm. Blue As Menu. Item mnuitm. Red As Menu. Item mnuitm. Green As Menu. Item 2002 Prentice Hall. All rights reserved. 8

30 31 32 33 34 35 36 37 38 39 40 41 42 43

30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 ' font Friend Friend submenu With. Events With. Events Outline mnuitm. Font As Menu. Item mnuitm. Times As Menu. Item mnuitm. Courier As Menu. Item mnuitm. Comic As Menu. Item mnuitm. Dash As Menu. Item mnuitm. Bold As Menu. Item mnuitm. Italic As Menu. Item ' Visual Studio. NET generated code This event handler displays a message box when the about menu item in the file menu is clicked ' display Message. Box Private Sub mnuitm. About_Click( _ By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. About. Click Message. Box. Show("This is an example" & vb. Cr. Lf & _ "of using menus. ", "About", Message. Box. Buttons. OK, _ Message. Box. Icon. Information) End Sub ' mnuitm. About_Click This event Menu. Test. vb handler terminates the application when the exit menu item in the file menu is clicked ' exit program Private Sub mnuitm. Exit_Click( _ By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Exit. Click Application. Exit() End Sub ' mnuitm. Exit_Click 2002 Prentice Hall. All rights reserved. 9

59 60 61 62 63 64 65 66 67 68 69 70 71 72

59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 Outline ' reset font color Private Sub Clear. Color() ' clear all checkmarks mnuitm. Black. Checked = False mnuitm. Blue. Checked = False mnuitm. Red. Checked = False mnuitm. Green. Checked = False End Sub ' Clear. Color Each color menu item must be mutually exclusive, so each event handler calls method Clear. Color ' update menu state and color display black Private Sub mnuitm. Black_Click(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Black. Click ' reset checkmarks for color menu items Clear. Color() ' set color to black lbl. Display. Fore. Color = Color. Black mnuitm. Black. Checked = True End Sub ' mnuitm. Black_Click Menu. Test. vb ' update menu state and color display blue Private Sub mnuitm. Blue_Click(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Blue. Click ' reset checkmarks for color menu items Clear. Color() ' set color to blue lbl. Display. Fore. Color = Color. Blue mnuitm. Blue. Checked = True End Sub ' mnuitm. Blue_Click 2002 Prentice Hall. All rights reserved. 10

93 94 95 96 97 98 99 100 101 102 103 104 105 106

93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 Outline ' update menu state and color display red Private Sub mnuitm. Red_Click(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Red. Click ' reset checkmarks for color menu items Clear. Color() ' set color to red lbl. Display. Fore. Color = Color. Red mnuitm. Red. Checked = True End Sub ' mnuitm. Red_Click ' update menu state and color display green Private Sub mnuitm. Green_Click(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Green. Click ' reset checkmarks for color menu items Clear. Color() ' set color to green lbl. Display. Fore. Color = Color. Green mnuitm. Green. Checked = True End Sub ' mnuitm. Green_Click ' reset font type Private Sub Clear. Font() Menu. Test. vb Each font menu item must be mutually exclusive, so each event handler calls method Clear. Font ' clear all checkmarks mnuitm. Times. Checked = False mnuitm. Courier. Checked = False mnuitm. Comic. Checked = False End Sub ' Clear. Font 2002 Prentice Hall. All rights reserved. 11

126 127 128 129 130 131 132 133 134 135 136 137 138 139

126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 ' update menu state and set font to Times Private Sub mnuitm. Times_Click(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Times. Click Outline ' reset checkmarks for font menu items Clear. Font() ' set Times New Roman font mnuitm. Times. Checked = True lbl. Display. Font = New Font("Times New Roman", 30, _ lbl. Display. Font. Style) End Sub ' mnuitm. Times_Click ' update menu state and set font to Courier Private Sub mnuitm. Courier_Click(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Courier. Click ' reset checkmarks for font menu items Clear. Font() Menu. Test. vb ' set Courier font mnuitm. Courier. Checked = True lbl. Display. Font = New Font("Courier New", 30, _ lbl. Display. Font. Style) End Sub ' mnuitm. Courier_Click ' update menu state and set font to Comic Sans MS Private Sub mnuitm. Comic_Click(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Comic. Click ' reset check marks for font menu items Clear. Font() 2002 Prentice Hall. All rights reserved. 12

159 ' set Comic Sans font 160 mnuitm. Comic. Checked = True 161 lbl.

159 ' set Comic Sans font 160 mnuitm. Comic. Checked = True 161 lbl. Display. Font = New Font("Comic Sans MS", 30, _ 162 lbl. Display. Font. Style) 163 End Sub ' mnuitm. Comic_Click 164 165 ' toggle checkmark and toggle bold style 166 Private Sub mnuitm. Bold_Click( _ 167 By. Val sender As System. Object, _ 168 By. Val e As System. Event. Args) Handles mnuitm. Bold. Click 169 170 ' toggle checkmark 171 mnuitm. Bold. Checked = Not mnuitm. Bold. Checked 172 173 ' use Xor to toggle bold, keep all other styles 174 lbl. Display. Font = New Font( _ 175 lbl. Display. Font. Family, 30, _ 176 lbl. Display. Font. Style Xor Font. Style. Bold) 177 End Sub ' mnuitm. Bold_Click 178 179 ' toggle checkmark and toggle italic style 180 Private Sub mnuitm. Italic_Click( _ 181 By. Val sender As System. Object, _ 182 By. Val e As System. Event. Args) Handles mnuitm. Italic. Click 183 184 ' toggle checkmark 185 mnuitm. Italic. Checked = Not mnuitm. Italic. Checked 186 187 ' use Xor to toggle italic, keep all other styles 188 lbl. Display. Font = New Font( _ 189 lbl. Display. Font. Family, 30, _ 190 lbl. Display. Font. Style Xor Font. Style. Italic) 191 End Sub ' mnuitm. Italic_Click 192 193 End Class ' Frm. Menu Outline Menu. Test. vb 2002 Prentice Hall. All rights reserved. 13

14 13. 2 Menus 2002 Prentice Hall. All rights reserved.

14 13. 2 Menus 2002 Prentice Hall. All rights reserved.

15 13. 3 Link. Labels • Link. Label – Displays links to other resources

15 13. 3 Link. Labels • Link. Label – Displays links to other resources • Files • Web pages – Behavior similar to web page hyperlink • Can change color – New – Previously visited 2002 Prentice Hall. All rights reserved.

16 13. 3 Link. Labels 2002 Prentice Hall. All rights reserved.

16 13. 3 Link. Labels 2002 Prentice Hall. All rights reserved.

13. 3 Link. Labels 2002 Prentice Hall. All rights reserved. 17

13. 3 Link. Labels 2002 Prentice Hall. All rights reserved. 17

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Outline ' Fig. 13. 8: Link. Label. Test. vb ' Using Link. Labels to create hyperlinks. Imports System. Windows. Forms Public Class Frm. Link. Label Inherits Form ' linklabels to C: drive, www. deitel. com and Notepad Friend With. Events lnklbl. CDrive As Link. Label Friend With. Events lnklbl. Deitel As Link. Label Friend With. Events lnklbl. Notepad As Link. Label ' Visual Studio. NET generated code Event handlers call method Start allowing execution of other programs from our application ' browse C: drive Private Sub lnklbl. CDrive_Link. Clicked( _ By. Val sender As System. Object, By. Val e As _ System. Windows. Forms. Link. Label. Link. Clicked. Event. Args ) _ Handles lnklbl. CDrive. Link. Clicked lnklbl. CDrive. Link. Visited = True System. Diagnostics. Process. Start( "C: ") End Sub ' lnklbl. CDrive ' load www. deitel. com in Web browser Private Sub lnklbl. Deitel_Link. Clicked( _ By. Val sender As System. Object, By. Val e As _ System. Windows. Forms. Link. Label. Link. Clicked. Event. Args ) _ Handles lnklbl. Deitel. Link. Clicked lnklbl. Deitel. Link. Visited = True System. Diagnostics. Process. Start( _ "IExplore", "http: //www. deitel. com") End Sub ' lnklbl. Deitel In this event handler method Start takes two arguments 2002 Prentice Hall. All rights reserved. 18

36 37 ' run application Notepad 38 Private Sub lnklbl. Notepad_Link. Clicked( _ 39

36 37 ' run application Notepad 38 Private Sub lnklbl. Notepad_Link. Clicked( _ 39 By. Val sender As System. Object, By. Val e As _ 40 System. Windows. Forms. Link. Label. Link. Clicked. Event. Args ) _ 41 Handles lnklbl. Notepad. Link. Clicked 42 43 lnklbl. Notepad. Link. Visited = True 44 45 ' run notepad application 46 ' full path not needed 47 System. Diagnostics. Process. Start( "notepad") 48 End Sub ' lnklbl. Notepad_Link. Clicked 49 50 End Class ' Link. Label. List Outline 2002 Prentice Hall. All rights reserved. 19

20 13. 3 Link. Labels 2002 Prentice Hall. All rights reserved.

20 13. 3 Link. Labels 2002 Prentice Hall. All rights reserved.

21 13. 3 Link. Labels 2002 Prentice Hall. All rights reserved.

21 13. 3 Link. Labels 2002 Prentice Hall. All rights reserved.

22 13. 3 Link. Labels 2002 Prentice Hall. All rights reserved.

22 13. 3 Link. Labels 2002 Prentice Hall. All rights reserved.

23 13. 4 List. Boxes and Checked. List. Boxes • List. Box – View

23 13. 4 List. Boxes and Checked. List. Boxes • List. Box – View and select from multiple items – Scroll bar appears if necessary • Checked. List. Box – Items have checkbox – Select multiple items at same time – Scroll bar appears if necessary 2002 Prentice Hall. All rights reserved.

24 13. 4 List. Boxes and Checked. List. Boxes 2002 Prentice Hall. All rights

24 13. 4 List. Boxes and Checked. List. Boxes 2002 Prentice Hall. All rights reserved.

13. 4. 1 List. Boxes 2002 Prentice Hall. All rights reserved. 25

13. 4. 1 List. Boxes 2002 Prentice Hall. All rights reserved. 25

26 13. 4. 1 List. Boxes 2002 Prentice Hall. All rights reserved.

26 13. 4. 1 List. Boxes 2002 Prentice Hall. All rights reserved.

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 Outline ' Fig. 13. 12: List. Box. Test. vb ' Program to add, remove and clear list box items. Imports System. Windows. Forms Public Class Frm. List. Box Inherits Form ' contains user-input list of elements Friend With. Events lst. Display As List. Box ' user-input textbox Friend With. Events txt. Input As Text. Box ' add, Friend remove, clear and exit command buttons With. Events cmd. Add As Button With. Events cmd. Remove As Button With. Events cmd. Clear As Button With. Events cmd. Exit As Button List. Box. Test. vb ' Visual Studio. NET generated code ' add new item (text from input box) and clear input box Private Sub cmd. Add_Click(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles cmd. Add. Click lst. Display. Items. Add(txt. Input. Text) txt. Input. Text = "" End Sub ' cmd. Add_Click The cmd. Add_Click event handler calls method add, which takes the text from the text box as a String ' remove item if one is selected Private Sub cmd. Remove_Click (By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles cmd. Remove. Click 2002 Prentice Hall. All rights reserved. 27

35 36 37 38 39 40 41 42 43 44 45 46 47 48

35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 ' remove only if item is selected If lst. Display. Selected. Index <> -1 Then lst. Display. Items. Remove. At(lst. Display. Selected. Index) End If Outline End Sub ' cmd. Remove_Click ' clear all items Private Sub cmd. Clear_Click (By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles cmd. Clear. Click lst. Display. Items. Clear() End Sub ' cmd. Clear_Click ' exit application Private Sub cmd. Exit_Click (By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles cmd. Exit. Click Application. Exit() End Sub ' cmd. Exit_Click List. Box. Test. vb End Class ' Frm. List. Box 2002 Prentice Hall. All rights reserved. 28

29 13. 4. 1 List. Boxes 2002 Prentice Hall. All rights reserved.

29 13. 4. 1 List. Boxes 2002 Prentice Hall. All rights reserved.

30 13. 4. 1 List. Boxes 2002 Prentice Hall. All rights reserved.

30 13. 4. 1 List. Boxes 2002 Prentice Hall. All rights reserved.

31 13. 4. 2 Checked. List. Boxes 2002 Prentice Hall. All rights reserved.

31 13. 4. 2 Checked. List. Boxes 2002 Prentice Hall. All rights reserved.

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 ' Fig. 13. 14: Checked. List. Box. Test. vb ' Using the checked list boxes to add items to a list box. Outline 32 Imports System. Windows. Forms Public Class Frm. Checked. List. Box Inherits Form ' list of available book titles Friend With. Events chklst. Input As Checked. List. Box ' user selection list Friend With. Events lst. Display As List. Box ' Visual Studio. NET generated code ' item about to change, add or remove from lst. Display Private Sub chklst. Input_Item. Check( _ By. Val sender As System. Object, _ By. Val e As System. Windows. Forms. Item. Check. Event. Args) _ Handles chklst. Input. Item. Checked. List. Box. Test. v b ' obtain reference of selected item Dim item As String = chklst. Input. Selected. Item ' if item checked add to listbox ' otherwise remove from listbox If e. New. Value = Check. State. Checked Then lst. Display. Items. Add(item) Else lst. Display. Items. Remove(item) End If End Sub ' chklst. Input_Item. Check An If/Else control structure determines whether the user checked or unchecked an item in the Checked. List. Box 2002 Prentice Hall. All rights reserved.

35 36 End Class ' Frm. Checked. List. Box Outline 33 Checked. List. Box.

35 36 End Class ' Frm. Checked. List. Box Outline 33 Checked. List. Box. Test. v b 2002 Prentice Hall. All rights reserved.

34 13. 5 Combo. Boxes • Combo. Box – Combines Text. Box features with

34 13. 5 Combo. Boxes • Combo. Box – Combines Text. Box features with drop-down list – Drop-down list • Contains a list from which a value can be selected • Scrollbar appears if necessary 2002 Prentice Hall. All rights reserved.

35 13. 5 Combo. Boxes 2002 Prentice Hall. All rights reserved.

35 13. 5 Combo. Boxes 2002 Prentice Hall. All rights reserved.

36 13. 5 Combo. Boxes 2002 Prentice Hall. All rights reserved.

36 13. 5 Combo. Boxes 2002 Prentice Hall. All rights reserved.

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Outline ' Fig. 13. 17: Combo. Box. Test. vb ' Using Combo. Box to select shape to draw. Imports System. Windows. Forms Imports System. Drawing Public Class Frm. Combo. Box Inherits Form ' contains shape list (circle, square, ellipse, pie) Friend With. Events cbo. Image As Combo. Box ' Visual Studio. NET generated code ' get selected index, draw shape Private Sub cbo. Image_Selected. Index. Changed( _ By. Val sender As System. Object, _ By. Val e As System. Event. Args) _ Handles cbo. Image. Selected. Index. Changed Event handler cbo. Image_Selected. Index. Change handles the Selected. Index. Change events generated when a user selects an item from the combo box ' create graphics object, pen and brush Dim my. Graphics As Graphics = My. Base. Create. Graphics() ' create Pen using color Dark. Red Dim my. Pen As New Pen(Color. Dark. Red) ' create Solid. Brush using color Dark. Red Dim my. Solid. Brush As New Solid. Brush(Color. Dark. Red) ' clear drawing area by setting it to color. AWhite select my. Graphics. Clear(Color. White) ' find index, draw proper shape Select Case cbo. Image. Selected. Index case structure is used to determine what item was selected 2002 Prentice Hall. All rights reserved. 37

36 Case 0 ' case circle is selected 37 my. Graphics. Draw. Ellipse(my. Pen,

36 Case 0 ' case circle is selected 37 my. Graphics. Draw. Ellipse(my. Pen, 50, 150) 38 39 Case 1 ' case rectangle is selected 40 my. Graphics. Draw. Rectangle(my. Pen, 50, 150) 41 42 Case 2 ' case ellipse is selected 43 my. Graphics. Draw. Ellipse(my. Pen, 50, 85, 150, 115) 44 45 Case 3 ' case pie is selected 46 my. Graphics. Draw. Pie(my. Pen, 50, 150, 0, 45) 47 48 Case 4 ' case filled circle is selected 49 my. Graphics. Fill. Ellipse( _ 50 my. Solid. Brush , 50, 150) 51 52 Case 5 ' case filled rectangle is selected 53 my. Graphics. Fill. Rectangle( _ 54 my. Solid. Brush , 50, 150) 55 56 Case 6 ' case filled ellipse is selected 57 my. Graphics. Fill. Ellipse( _ 58 my. Solid. Brush , 50, 85, 150, 115) 59 60 Case 7 ' case filled pie is selected 61 my. Graphics. Fill. Pie( _ 62 my. Solid. Brush , 50, 150, 0, 45) 63 64 End Select 65 66 End Sub ' cbo. Image_Selected. Index. Changed 67 68 End Class ' Frm. Combo. Box Outline 2002 Prentice Hall. All rights reserved. 38

39 13. 5 Combo. Boxes 2002 Prentice Hall. All rights reserved.

39 13. 5 Combo. Boxes 2002 Prentice Hall. All rights reserved.

40 13. 5 Combo. Boxes 2002 Prentice Hall. All rights reserved.

40 13. 5 Combo. Boxes 2002 Prentice Hall. All rights reserved.

41 13. 6 Tree. View • Tree. View Control – Displays nodes hierarchically –

41 13. 6 Tree. View • Tree. View Control – Displays nodes hierarchically – Nodes • Objects that contain values – Parent node • Contains child nodes • Can be expanded or collapsed – Root node • First parent node of a tree – Sibling nodes • Have same parent node – Child nodes • Can have child nodes of their own 2002 Prentice Hall. All rights reserved.

42 13. 6 Tree. View 2002 Prentice Hall. All rights reserved.

42 13. 6 Tree. View 2002 Prentice Hall. All rights reserved.

43 13. 6 Tree. View 2002 Prentice Hall. All rights reserved.

43 13. 6 Tree. View 2002 Prentice Hall. All rights reserved.

13. 6 Tree. View 2002 Prentice Hall. All rights reserved. 44

13. 6 Tree. View 2002 Prentice Hall. All rights reserved. 44

45 13. 6 Tree. View 2002 Prentice Hall. All rights reserved.

45 13. 6 Tree. View 2002 Prentice Hall. All rights reserved.

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 ' Fig. 13. 22: Tree. View. Directory. Structure. Test. vb ' Using Tree. View to display directory structure. Outline 46 Imports System. Windows. Forms Imports System. IO Public Class Frm. Tree. View. Directory Inherits Form ' contains view of c: drive directory structure Friend With. Events tre. Directory As Tree. View ' Visual Studio. NET generated code ' add all subfolders of 'directory. Value' to 'parent. Node' Private Sub Populate. Tree. View(By. Val directory. Value As String, _ By. Val parent. Node As Tree. Node) ' populate current node with subdirectories Try Tree. View. Directory. Str ucture. Test. vb ' get all subfolders Dim directory. Array As String() = _ Directory. Get. Directories(directory. Value) If directory. Array. Length <> 0 Then ' if at least one Dim current. Directory As String ' for every subdirectory, create new Tree. Node, ' add as child of current node and ' recursively populate child nodes with subdirectories For Each current. Directory In directory. Array 2002 Prentice Hall. All rights reserved.

35 36 37 38 39 40 41 42 43 44 45 46 47 48

35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 ' create Tree. Node for current directory Dim my. Node As Tree. Node = _ New Tree. Node(current. Directory) Outline ' add current directory node to parent node parent. Nodes. Add(my. Node) ' recursively populate every subdirectory Populate. Tree. View (current. Directory, my. Node) Next End If ' catch exception Catch unauthorized As Unauthorized. Access. Exception parent. Nodes. Add("Access Denied") End Try End Sub ' Populate. Tree. View Adds a root node to the Tree. View called tre. Directory. C: ' called by system when form loads Private Sub Frm. Tree. View. Directory_Load(By. Val sender As Object, _ By. Val e As System. Event. Args) Handles My. Base. Load ' add c: drive to tre. Directory and insert its subfolders tre. Directory. Nodes. Add("C: ") Populate. Tree. View("C: ", tre. Directory. Nodes(0)) End Sub ' Frm. Tree. View. Directory_Load End Class ' Frm. Tree. View. Directory Method Populate. Tree. View takes a directory and a parent node 2002 Prentice Hall. All rights reserved. 47

48 13. 6 Tree. View 2002 Prentice Hall. All rights reserved.

48 13. 6 Tree. View 2002 Prentice Hall. All rights reserved.

49 13. 6 Tree. View 2002 Prentice Hall. All rights reserved.

49 13. 6 Tree. View 2002 Prentice Hall. All rights reserved.

50 13. 7 List. Views • List. View Control – – Similar to List.

50 13. 7 List. Views • List. View Control – – Similar to List. Box View and select from multiple items Select multiple items at same time Displays icons along side of list items 2002 Prentice Hall. All rights reserved.

13. 7 List. Views 2002 Prentice Hall. All rights reserved. 51

13. 7 List. Views 2002 Prentice Hall. All rights reserved. 51

52 13. 7 List. Views 2002 Prentice Hall. All rights reserved.

52 13. 7 List. Views 2002 Prentice Hall. All rights reserved.

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 ' Fig. 13. 25: List. View. Test. vb ' Displaying directories and their contents in List. View. Outline Imports System. Windows. Forms Imports System. IO Public Class Frm. List. View Inherits Form ' display labels for current location in directory tree Friend With. Events lbl. Current As Label Friend With. Events lbl. Display As Label ' displays contents of current directory Friend With. Events lvw. Browser As List. View ' specifies images for file icons and folder icons Friend With. Events ils. File. Folder As Image. List. View. Test. vb ' Visual Studio. NET generated code ' get current directory Dim current. Directory As String = _ Directory. Get. Current. Directory() ' browse directory user clicked or go up one level Private Sub lvw. Browser_Click(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles lvw. Browser. Click ' ensure item selected If lvw. Browser. Selected. Items. Count <> 0 Then ' if first item selected, go up one level If lvw. Browser. Items(0). Selected Then If Selected. Items. Count = 0 then an item could not have been selected 2002 Prentice Hall. All rights reserved. 53

36 37 38 39 40 41 42 43 44 45 46 47 48 49

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 Outline ' create Directory. Info object for directory Dim directory. Object As Directory. Info = _ New Directory. Info(current. Directory) ' if directory has parent, load it If Not (directory. Object. Parent Is Nothing) Then Load. Files. In. Directory ( _ directory. Object. Parent. Full. Name) End If ' selected directory or file Else ' directory or file chosen Dim chosen As String = _ lvw. Browser. Selected. Items(0). Text ' if item selected is directory If Directory. Exists(current. Directory & _ "" & chosen) Then If the selected directory has a parent directory then load it If the first item was not selected then a directory or file must have List. View. Test. vb been chosen ' load subdirectory Method Exists returns True ' if in c: , do not need "", otherwise we do if its String parameter is a directory If current. Directory = "C: " Then Load. Files. In. Directory (current. Directory & chosen) Else Load. Files. In. Directory (current. Directory & _ "" & chosen) End If 2002 Prentice Hall. All rights reserved. 54

70 71 72 73 74 75 76 77 78 79 80 81 82 83

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 ' update lbl. Display. Text = current. Directory End If Outline End Sub ' lvw. Browser_Click ' display files/subdirectories of current directory Public Sub Load. Files. In. Directory( _ By. Val current. Directory. Value As String) ' load directory information and display Try ' clear List. View and set first item lvw. Browser. Items. Clear() lvw. Browser. Items. Add("Go Up One Level") ' update current directory current. Directory = current. Directory. Value Dim new. Current. Directory As Directory. Info = _ New Directory. Info(current. Directory) List. View. Test. vb Files and directories are put into arrays ' put files and directories into arrays Dim directory. Array As Directory. Info() = _ new. Current. Directory. Get. Directories() Dim file. Array As File. Info() = _ new. Current. Directory. Get. Files() ' add directory names to List. View Dim dir As Directory. Info A For Each loop is used to add directories to the List. View For Each dir In directory. Array 2002 Prentice Hall. All rights reserved. 55

104 105 106 107 108 109 110 111 112 113 114 115 116 117

104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 Outline ' add directory to listview Dim new. Directory. Item As List. View. Item = _ lvw. Browser. Items. Add(dir. Name) ' set directory image new. Directory. Item. Image. Index = 0 Next A For Each loop is used to add file names to the List. View ' add file names to List. View Dim file As File. Info For Each file In file. Array ' add file to List. View Dim new. File. Item As List. View. Item = _ lvw. Browser. Items. Add(file. Name) new. File. Item. Image. Index = 1 Next ' set file image List. View. Test. vb ' access denied Catch exception As Unauthorized. Access. Exception Message. Box. Show("Warning: Some files may " & _ "not be visible due to permission settings" , _ "Attention", 0, Message. Box. Icon. Warning) End Try End Sub ' Load. Files. In. Directory ' handle load event when Form displayed for first time Private Sub Frm. List. View_Load(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles My. Base. Load 2002 Prentice Hall. All rights reserved. 56

137 138 139 140 141 142 143 144 145 146 147 148 149 150

137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 ' set image list Dim folder. Image As Image = Image. From. File _ (current. Directory & "imagesfolder. bmp") Outline Dim file. Image As Image = Image. From. File _ (current. Directory & "imagesfile. bmp") ils. File. Folder. Images. Add(folder. Image) ils. File. Folder. Images. Add(file. Image) ' load current directory into browser. List. View Load. Files. In. Directory (current. Directory) lbl. Display. Text = current. Directory End Sub ' Frm. List. View_Load End Class ' Frm. List. View. Test. vb 2002 Prentice Hall. All rights reserved. 57

58 13. 7 List. Views 2002 Prentice Hall. All rights reserved.

58 13. 7 List. Views 2002 Prentice Hall. All rights reserved.

59 13. 8 Tab Control • Tab. Control – Creates tabbed windows – Saves

59 13. 8 Tab Control • Tab. Control – Creates tabbed windows – Saves space using Tab. Page objects • Tab. Page objects – Similar to Panels and Group. Boxes – Can contain controls 2002 Prentice Hall. All rights reserved.

60 13. 8 Tab Control 2002 Prentice Hall. All rights reserved.

60 13. 8 Tab Control 2002 Prentice Hall. All rights reserved.

61 13. 8 Tab Control 2002 Prentice Hall. All rights reserved.

61 13. 8 Tab Control 2002 Prentice Hall. All rights reserved.

62 13. 8 Tab Control 2002 Prentice Hall. All rights reserved.

62 13. 8 Tab Control 2002 Prentice Hall. All rights reserved.

63 13. 8 Tab Control 2002 Prentice Hall. All rights reserved.

63 13. 8 Tab Control 2002 Prentice Hall. All rights reserved.

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 ' Fig. 13. 30: Using. Tabs. vb ' Using Tab. Control to display various font settings. Outline Imports System. Windows. Forms Public Class Frm. Tabs Inherits Form ' output label reflects text changes Friend With. Events lbl. Display As Label ' table control containing table pages tbp. Color, ' tbp. Size, tbp. Message and tbp. About Friend With. Events tbc. Text. Options As Tab. Control ' table page containing color options Friend With. Events tbp. Color As Tab. Page Friend With. Events rad. Black As Radio. Button Friend With. Events rad. Red As Radio. Button Friend With. Events rad. Green As Radio. Button ' table page containing font size options Friend With. Events tbp. Size As Tab. Page Friend With. Events rad. Size 12 As Radio. Button Friend With. Events rad. Size 16 As Radio. Button Friend With. Events rad. Size 20 As Radio. Button ' table page containing text display options Friend With. Events tbp. Message As Tab. Page Friend With. Events rad. Hello As Radio. Button Friend With. Events rad. Goodbye As Radio. Button ' table page containing about message Friend With. Events tbp. About As Tab. Page Friend With. Events lbl. Message As Label 2002 Prentice Hall. All rights reserved. 64

36 37 38 39 40 41 42 43 44 45 46 47 48 49

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 ' Visual Studio. NET generated code Outline ' event handler for black radio button Private Sub rad. Black_Checked. Changed( _ By. Val sender As System. Object, By. Val e As System. Event. Args) _ Handles rad. Black. Checked. Changed lbl. Display. Fore. Color = Color. Black End Sub ' rad. Black_Checked. Changed ' event handler for red radio button Private Sub rad. Red_Checked. Changed( _ By. Val sender As System. Object, By. Val e As System. Event. Args) _ Handles rad. Red. Checked. Changed lbl. Display. Fore. Color = Color. Red End Sub ' rad. Red_Checked. Changed ' event handler for green radio button Private Sub rad. Green_Checked. Changed( _ By. Val sender As System. Object, By. Val e As System. Event. Args) _ Handles rad. Green. Checked. Changed lbl. Display. Fore. Color = Color. Green End Sub ' rad. Green_Checked. Changed ' event handler for size 12 radio button Private Sub rad. Size 12_Checked. Changed( _ By. Val sender As System. Object, By. Val e As System. Event. Args) _ Handles rad. Size 12. Checked. Changed lbl. Display. Font = New Font(lbl. Display. Font. Name, 12) End Sub ' rad. Size 12_Checked. Changed 2002 Prentice Hall. All rights reserved. 65

71 72 73 74 75 76 77 78 79 80 81 82 83 84

71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 ' event handler for size 16 radio button Private Sub rad. Size 16_Checked. Changed( _ By. Val sender As System. Object, By. Val e As System. Event. Args) _ Handles rad. Size 16. Checked. Changed Outline lbl. Display. Font = New Font(lbl. Display. Font. Name, 16) End Sub ' rad. Size 16_Checked. Changed ' event handler for size 20 radio button Private Sub rad. Size 20_Checked. Changed( _ By. Val sender As System. Object, By. Val e As System. Event. Args) _ Handles rad. Size 20. Checked. Changed lbl. Display. Font = New Font(lbl. Display. Font. Name, 20) End Sub ' rad. Size 20_Checked. Changed ' event handler for message "Hello!" radio button Private Sub rad. Hello_Checked. Changed( _ By. Val sender As System. Object, By. Val e As System. Event. Args) _ Handles rad. Hello. Checked. Changed lbl. Display. Text = "Hello!" End Sub ' rad. Hello_Checked. Changed ' event handler for message "Goodbye!" radio button Private Sub rad. Goodbye_Checked. Changed( _ By. Val sender As System. Object, By. Val e As System. Event. Args) _ Handles rad. Goodbye. Checked. Changed lbl. Display. Text = "Goodbye!" End Sub ' rad. Goodbye_Checked. Changed End Class ' Frm. Tabs 2002 Prentice Hall. All rights reserved. 66

67 13. 8 Tab Control 2002 Prentice Hall. All rights reserved.

67 13. 8 Tab Control 2002 Prentice Hall. All rights reserved.

13. 9 Multiple Document Interface (MDI) Windows • MDI – Allows multiple windows •

13. 9 Multiple Document Interface (MDI) Windows • MDI – Allows multiple windows • Parent window – Application window – Can have many child windows • Child window – Cannot be parent – Has exactly one parent – Cannot be moved outside parent – Functionality can be different than other child windows from same parent 2002 Prentice Hall. All rights reserved. 68

13. 9 Multiple Document Interface (MDI) Windows Single Document Interface (SDI) 2002 Prentice Hall.

13. 9 Multiple Document Interface (MDI) Windows Single Document Interface (SDI) 2002 Prentice Hall. All rights reserved. Multiple Document Interface (MDI) 69

13. 9 Multiple Document Interface (MDI) Windows 2002 Prentice Hall. All rights reserved. 70

13. 9 Multiple Document Interface (MDI) Windows 2002 Prentice Hall. All rights reserved. 70

13. 9 Multiple Document Interface (MDI) Windows 2002 Prentice Hall. All rights reserved. 71

13. 9 Multiple Document Interface (MDI) Windows 2002 Prentice Hall. All rights reserved. 71

13. 9 Multiple Document Interface (MDI) Windows 2002 Prentice Hall. All rights reserved. 72

13. 9 Multiple Document Interface (MDI) Windows 2002 Prentice Hall. All rights reserved. 72

13. 9 Multiple Document Interface (MDI) Windows 2002 Prentice Hall. All rights reserved. 73

13. 9 Multiple Document Interface (MDI) Windows 2002 Prentice Hall. All rights reserved. 73

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 ' Fig. 13. 37: Using. MDI. vb ' Demonstrating use of MDI parent and child windows. Outline Imports System. Windows. Forms Public Class Frm. Using. MDI Inherits Form ' main menu containing menu items File and Window Friend With. Events mnu. Main As Main. Menu ' menu containing submenu New and menu item Exit Friend With. Events mnuitm. File As Menu. Item Friend With. Events mnuitm. Exit As Menu. Item ' submenu New Friend With. Events ' menu containing ' Tile. Vertical Friend With. Events mnuitm. New As mnuitm. Child 1 mnuitm. Child 2 mnuitm. Child 3 Menu. Item As Menu. Item menu items Cascade, Tile. Horizontal and mnuitm. Window As Menu. Item mnuitm. Cascade As Menu. Item mnuitm. Tile. Horizontal As Menu. Item mnuitm. Tile. Vertical As Menu. Item ' Visual Studio. NET generated code ' create Child 1 when menu clicked Private Sub mnuitm. Child 1_Click( _ By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Child 1. Click 2002 Prentice Hall. All rights reserved. 74

36 37 38 39 40 41 42 43 44 45 46 47 48 49

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 ' create image path Dim image. Path As String = _ Directory. Get. Current. Directory() & "imagesimage 0. jpg" Outline ' create new child. Window = New Frm. Child(image. Path, "Child 1") child. Window. Mdi. Parent = Me ' set parent child. Window. Show() ' display child End Sub ' mnuitm. Child 1_Click ' create Child 2 when menu clicked Private Sub mnuitm. Child 2_Click( _ By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Child 2. Click ' create image path Dim image. Path As String = _ Directory. Get. Current. Directory() & "imagesimage 1. jpg" ' create new child. Window = New Frm. Child(image. Path, "Child 2") child. Window. Mdi. Parent = Me ' set parent child. Window. Show() ' display child End Sub ' mnuitm. Child 2_Click ' create Child 3 when menu clicked Private Sub mnuitm. Child 3_Click( _ By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Child 3. Click ' create image path Dim image. Path As String = _ Directory. Get. Current. Directory() & "imagesimage 2. jpg" 2002 Prentice Hall. All rights reserved. 75

70 71 72 73 74 75 76 77 78 79 80 81 82 83

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ' create new child. Window = New Frm. Child(image. Path, "Child 3") child. Window. Mdi. Parent = Me ' set parent child. Window. Show() ' display child End Sub ' mnuitm. Child 3_Click Outline ' exit application Private Sub mnuitm. Exit_Click(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Exit. Click Application. Exit() End Sub ' mnuitm. Exit_Click ' set cascade layout Private Sub mnuitm. Cascade_Click(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Cascade. Click Me. Layout. Mdi(Mdi. Layout. Cascade) End Sub ' mnuitm. Cascade_Click Method Layout. Mdi can take values Arrange. Icons, Cascade, Tile. Horizontal and Tile. Vertical ' set Tile. Horizontal layout Private Sub mnuitm. Tile. Horizontal_Click( _ By. Val sender As System. Object, By. Val e As System. Event. Args) _ Handles mnuitm. Tile. Horizontal. Click Me. Layout. Mdi(Mdi. Layout. Tile. Horizontal) End Sub ' mnuitm. Tile. Horizontal_Click ' set Tile. Vertical layout Private Sub mnuitm. Tile. Vertical_Click( _ By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles mnuitm. Tile. Vertical. Click 2002 Prentice Hall. All rights reserved. 76

103 Me. Layout. Mdi(Mdi. Layout. Tile. Vertical) 104 End Sub ' mnuitm. Tile. Vertical_Click

103 Me. Layout. Mdi(Mdi. Layout. Tile. Vertical) 104 End Sub ' mnuitm. Tile. Vertical_Click 105 106 End Class ' Frm. Using. MDI Outline 2002 Prentice Hall. All rights reserved. 77

13. 9 Multiple Document Interface (MDI) Windows 2002 Prentice Hall. All rights reserved. 78

13. 9 Multiple Document Interface (MDI) Windows 2002 Prentice Hall. All rights reserved. 78

79 13. 10 Visual Inheritance • Allows creation of forms by inheriting from other

79 13. 10 Visual Inheritance • Allows creation of forms by inheriting from other forms • Derived forms contain same functionality as base form including: – – – Properties Methods Variables Controls All visual aspects • • Sizing Layout Spacing Colors and fonts 2002 Prentice Hall. All rights reserved.

1 ' Fig. 13. 39: Frm. Inheritance. vb 2 ' Form template for use

1 ' Fig. 13. 39: Frm. Inheritance. vb 2 ' Form template for use with visual inheritance. 3 4 Imports System. Windows. Forms 5 6 Public Class Frm. Inheritance 7 Inherits Form 8 9 Friend With. Events lbl. Bug As Label ' top label 10 Friend With. Events lbl. Copyright As Label ' bottom label 11 Friend With. Events cmd. Learn As Button ' left button 12 13 ' Visual Studio. NET generated code 14 15 ' invoked when user clicks Learn More button 16 Private Sub cmd. Learn_Click(By. Val sender As System. Object, _ 17 By. Val e As System. Event. Args) Handles cmd. Learn. Click 18 19 Message. Box. Show("Bugs, Bugs is a product of " & _ 20 " Bug 2 Bug. com. ", "Learn More", Message. Box. Buttons. OK, _ 21 Message. Box. Icon. Information) 22 End Sub ' cmd. Learn_Click 23 24 End Class ' Frm. Inheritance Outline Method cmd. Learn_Click is invoked Frm. Inheritance. vb 2002 Prentice Hall. All rights reserved. 80

81 13. 10 Visual Inheritance 2002 Prentice Hall. All rights reserved.

81 13. 10 Visual Inheritance 2002 Prentice Hall. All rights reserved.

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Outline ' Fig. 13. 41: Visual. Test. vb ' A form that uses visual inheritance. Public Class Frm. Visual. Test Inherits Visual. Form. Frm. Inheritance ' new button added to form Friend With. Events cmd. Program As Button ' Visual Studio. NET generated code Components, layout and functionality of the base form are inherited by the new form ' invoke when user clicks Learn the Program button Private Sub cmd. Program_Click(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles cmd. Program. Click Message. Box. Show( _ "This program was created by Deitel & Associates" , _ "Learn the Program", Message. Box. Buttons. OK, _ Message. Box. Icon. Information) End Sub ' cmd. Program_Click Visual. Test. vb End Class ' Frm. Visual. Test 2002 Prentice Hall. All rights reserved. 82

83 13. 10 Visual Inheritance 2002 Prentice Hall. All rights reserved.

83 13. 10 Visual Inheritance 2002 Prentice Hall. All rights reserved.

84 13. 11 User-Defined Controls • Custom controls – Techniques • Inherit from class

84 13. 11 User-Defined Controls • Custom controls – Techniques • Inherit from class Control – Define a brand new control • Inherit from Windows Forms control – Add functionality to preexisting control • Create a User. Control – Multiple preexisting controls 2002 Prentice Hall. All rights reserved.

85 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved.

85 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved.

1 2 3 4 5 6 7 8 9 10 11 12 13 14

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 ' Fig 13. 43: CClock. User. Control. vb ' User-defined control with timer and label. Outline 86 Imports System. Windows. Forms ' create clock control that inherits from User. Control Public Class CClock. User. Control Inherits User. Control ' displays time Friend With. Events lbl. Display As Label ' non-visible event-triggering timer object Friend With. Events tmr. Clock As Timer ' Visual Studio. NET generated code ' update label at every tick Private Sub tmr. Clock_Tick(By. Val sender As System. Object, _ By. Val e As System. Event. Args) Handles tmr. Clock. Tick CClock. User. Control. v b ' get current time (Now), convert to string lbl. Display. Text = Date. Time. Now. To. Long. Time. String End Sub ' tmr. Clock_Tick End Class ' CClock. User. Control 2002 Prentice Hall. All rights reserved.

87 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved.

87 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved.

88 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved.

88 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved.

89 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved.

89 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved.

90 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved.

90 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved.

91 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved.

91 13. 11 User-Defined Controls 2002 Prentice Hall. All rights reserved.