CECS 5020 - University of North Texas

Download Report

Transcript CECS 5020 - University of North Texas

CECS 5020
Computers in Education
Forms and Menus
Types of Forms
 Single
Document Interface
– One document at a time
 Multiple
Document Interface
– More than one document at a time
– “Child” forms on the MDI form are constrained
to stay inside the MDI form
CECS 5020
Experiment with SDI and MDI Forms
 Create
two forms, Form1 and Form2, both
of which have their “MDI Child” properties
set to False
 Add a line to Form1’s Load event to show
Form2 (“Form2.Show”)
CECS 5020
Creating a MDI Form
 Add
a new MDI form (Project/Add MDI
Form)
 Set the MDI Child property of Form 2 to
“True”
 Run the program and see how Form 2
behaves when you resize it and move it
outside of the MDI form’s boundaries
 Note how Form 1 behaves also
CECS 5020
Form Properties
 Caption
 Icon
 Height,
Width, Left, Top
 Background Color
 MouseIcon, MousePointer (99 for custom)
 StartUp Position
 WindowState
CECS 5020
Form Events
 Resize
– Use this event to re-size child controls or forms
 Click
 MouseMove
 Load
 Unload
CECS 5020
Code a Form Event
 Create
a new project with an MDI Form and a
child form
 Code the MDI Form’s Resize event to resize the
child form to 1/2 the size of the MDIForm
Private Sub MDIForm_Resize()
Form1.Width = MDIForm1.Width / 2
Form1.Height = MDIForm1.Height / 2
End Sub
CECS 5020
Menus
 Menu
Editor
– Creates hierarchical menus
– Captions that are only - (hyphen) create
separator bars
– Shortcut keys are created by putting an
ampersand before the letter that is the shortcut
» &File
» E&xit
CECS 5020
Creating a Menu for Your Project
 Tools/Menu
Editor
 &File
» &New
» &Open
» E&xit
– &Edit
– &Help
CECS 5020