CBVP2103 MDI (Multiple Document Interface) forms are forms that are - - PowerPoint PPT Presentation

cbvp2103 mdi multiple document interface forms are forms
SMART_READER_LITE
LIVE PREVIEW

CBVP2103 MDI (Multiple Document Interface) forms are forms that are - - PowerPoint PPT Presentation

CBVP2103 MDI (Multiple Document Interface) forms are forms that are created to hold other forms. The MDI form is often referred to as the parent, and the forms displayed within the MDI parent are often called children. In VB.NET, a


slide-1
SLIDE 1

CBVP2103

slide-2
SLIDE 2

 MDI (Multiple Document Interface) forms are

forms that are created to hold other forms.

 The MDI form is often referred to as the

parent, and the forms displayed within the MDI parent are often called children.

slide-3
SLIDE 3

 In VB.NET, a regular form is converted to an

MDI parent form by setting the IsMDIContainer property of the form to True. This is normally done in the Properties window at design time.

 A form can also be made into an MDI parent

at runtime by setting the IsMDIContainer property to True in code. However, the design

  • f an MDI form is usually rather different

from that of a normal form, so this approach is not often needed.

slide-4
SLIDE 4

 In VB6, an MDI parent form can only contain

controls that have a property called Align. This property determines to which side of the MDI parent form the control is supposed to be

  • docked. Typical controls like buttons and text

boxes cannot be added directly to an MDI parent

  • form. They must be added to a container control,

such as a PictureBox, which has an Align property.

 In VB.NET, an MDI parent can contain any control

that a regular form can contain. Buttons, labels, and the like can be placed directly on the MDI

  • surface. Such controls will appear in front of any

MDI child forms that are displayed in the MDI client area.

slide-5
SLIDE 5

 In VB.NET, a form becomes an MDI child at

runti ntime me by setting the form’s MDIParent property to point to an MDI parent form. In fact, the MDIParent property cannot t be set at design

  • time. (Note that this is completely different from

VB6, where it was necessary to make a form an MDI child at design time.)

 Any number of MDI child forms can be displayed

in the MDI parent client area. The currently active child form can be determined with the ActiveForm property of the MDI parent form.

slide-6
SLIDE 6

 There are three basic techniques for the

creation of custom Windows Forms controls in .NET:

  • Inherit from an existing control
  • Build a composite control (using the UserControl

class as your starting point)

  • Write a control from scratch (using the very simple

Control class as your starting point)

slide-7
SLIDE 7

 The simplest technique starts with a complete

Windows Forms control that is already

  • developed. A new class is created that

inherits the existing control.

 Most of the built-in Windows Forms controls

can be used as the base class for such an inherited control.

slide-8
SLIDE 8

 Here are some typical examples where it

might make sense to extend an existing Windows Forms control:

  • A text box with built-in validation for specific types
  • f information
  • A self-loading list box, combo box, or data grid
  • A menu control that varies its options based on the

current user

  • A NumericUpDown control that generates a special

event when it reaches 80 percent of its maximum allowed value

slide-9
SLIDE 9

 In some cases, a single existing control does not

furnish the needed functionality, but a combination of two or more existing controls

  • does. Here are some typical examples:
  • A set of buttons with related logic that are always

used together (such as “Save,” “Delete,” and “Cancel” buttons on a file maintenance form)

  • A set of text boxes to hold a name, address, and

phone number, with the combined information formatted and validated in a particular way

  • A set of option buttons with a single property exposed

as the chosen option

  • A data grid together with buttons that alter its

appearance or behavior in specific ways

slide-10
SLIDE 10

 If a control needs to have special functionality

not related to any existing control, then it can be written from scratch to draw its own visual interface and implement its own logic. This

  • ption requires more work, but allows us to do

just about anything that is possible within .NET and Windows Forms, including very sophisticated drawing of a user interface.

 To write a control from scratch, it is necessary to

inherit from the Control class, which gives basic functionality such as properties for colors and size.