Documente Academic
Documente Profesional
Documente Cultură
Objectives
1. How to design a good user interface 2. Use Toolbox tools to create and modify forms and controls 3. Multiple Document Interface (MDI) vs. Single Document Interface (SDI) vs. Explorer-style interface 4. Create input features such as text boxes, labels and command buttons
Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc. 2
Objectives
5. Include graphics using picture box or image controls 6. Create a Graphical User Interface with menus 7. Include file management features using drive list boxes, directory list boxes and file list boxes 8. Include frames, check boxes, option buttons, combo boxes, and list boxes
Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc. 3
Child Form
Child Form
Independent Form
Explorer-style interface
Principle 2: Be Consistent
Use Windows Guidelines - Close button Windows standard fonts - Arial, Times New Roman, and MS Sans Serif Establish font color and size, background color, and foreground color Use menus and standard menu positions See Appendix D - Standard Menus for Windows Applications
Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc. 10
Principle 3: Show and Use Informative Graphics and Messages Show user, instead of telling Use informative graphics, instead of merely creative graphics Graphics especially useful for international applications GUI analogy - dashboard of car Use symbols, not words
Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc. 11
14
15
The Toolbox
Intrinsic Controls - always included in the Toolbox ActiveX Controls - separate files with ocx file extension Insertable Objects - objects from another application such as a spreadsheet, or document
Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc. 17
Intrinsic Controls
Pointer tool Label Frame Check box Picture box Text box Command button Option button List box Vertical scroll bar Drive list File list box Line Data
Copyright 1999 Prentice-Hall, Inc. 18
Combo box
Horizontal scroll bar Timer Directory list box
Shape
Image OLE container
Exploring MS Visual Basic 6
Get Input
Text box - text input Horizontal Scroll bars - navigate choices Vertical Scroll bars - navigate choices Check box - more than one choice Option buttons - mutually exclusive choices
List box - 1 choice from list Combo box - choose or type a choice
Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc. 19
Get Input
Tabbed dialog - present many options MsgBox function - prompt user or display message InputBox function - present predefined dialog boxes Common dialog - display standard dialog boxes such as Open, Save and Print Customized dialog box - create your own
Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc. 20
Display Graphics
Image - use to create an icon command button, decorative images Picture box - use to create a toolbar Line - draw a straight line segment Shape - draw a rectangle, square, ellipse, or circle Background Property - background image LoadPicture function - use at runtime
Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc. 21
22
Miscellaneous Controls
Frame - use to group controls together Timer - use to trigger simple animations or like a stopwatch OLE container - use to link or embed objects from other applications
23
edit and update data from existing databases uses same database engine that powers Microsoft Access
24
25
Create a new project Add the existing starter form Add a Splash form Add the Main module Modify the Main form Code the Main form Run and debug the project Add code to display icons Run and debug the new code Print your project and exit
Copyright 1999 Prentice-Hall, Inc. 26
Elements of a Menu
Menu bar
Menu title
Menu items
Separator bar
27
Menu title Menu items Separator bar Menu control list box
28
29
30
Menu Design
Use short menu names, single word Use unique menu items for each menu Group menus logically Choose a logical access key for menu items Choose logical keyboard shortcuts for most commonly used commands
Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc. 31
Open the Learning Arithmetic project Save project files with a new name Add menu titles Add menu items Modify the About form Add the HowTo form and controls Add code to activate the menus Test the menus and forms
Copyright 1999 Prentice-Hall, Inc. 32
Summary ...
Design GUIs using 5 basic design principles
1. Know your end user 2. Be consistent 3. Use informative graphics and messages 4. Keep it simple 5. Let the user control the application
Summary
Add controls to forms using tools from the toolbox Intrinsic controls are always in the toolbox ActiveX controls and Insertable Objects can be added to the toolbox Use the Menu Editor to add menus Add code to activate the menus
Exploring MS Visual Basic 6 Copyright 1999 Prentice-Hall, Inc. 34
35
Case Studies
Create a Prototype Insertable Objects ActiveX Controls Controls from the Web
36