VB user Interface (i)

Source: Internet
Author: User
Tags resource

Interface style

If you have used windows-based applications, you may have noticed that not all user interfaces look or operate the same. There are two main types of user interface styles: Single Document Interface (SDI) and multiple Document interface (MDI). An example of an SDI interface is the WordPad (Notepad) application in Microsoft Windows (Figure 6.1). In WordPad, you can open only one document, and when you want to open another document, you must close the open document first.

Applications such as Microsoft Excel and Microsoft Word for Windows are MDI interfaces; they allow multiple documents to be displayed at the same time, and each document is displayed in its own window (Figure 6.2). An MDI application can be identified by including a Windows menu item that has a submenu that can be toggled between a window or a document.
To determine which interface style is best, you need to look at the purpose of the application. An application that handles insurance claims may use a multiple-document interface MDI style, one employee is likely to handle more than one claim at a time, or a two claim comparison is required. On the other hand, the calendar program is best set to the SDI single document interface style, because it is not necessary to open more than one calendar at the same time; In rare cases, you can open an instance of a single document interface application.

SDI styles are more common and most of the examples in the Programmer's Guide are SDI applications. About creating MDI applications There are a number of issues and techniques that need to be considered separately, in the "Multiple Document Interface (MDI) Applications" section later in this chapter.
In addition to the two most commonly used interface styles SDI and MDI, the third interface style becomes more and more popular, which is the Resource Manager style interface (Figure 6.3). The Explorer style interface consists of a separate window with two panes or regions, usually consisting of a tree or a hierarchical view of the left half and a display area of the right half, as seen in MicrosoftWindows's resource manager. This style of interface can be used to locate or browse a large number of documents, pictures, or files. In addition to the MDI and SDI application examples included in this chapter, the Utility Wizard provides a way to compare interface style differences. You can use wizards to build a frame for each style, and then observe the forms and code that it generates.

More information to learn more about MDI applications, see the "Multiple Document Interface (MDI) applications" section. For the basics of using forms, see chapter III, "Forms, controls, and menus." For information about the Access Utility Wizard, see the "Using wizards and add-Ins" section in chapter fourth, "Management of projects".

Multiple-document interface (MDI) applications

Multi-Document Interface (MDI) allows you to create applications that contain multiple forms in a single container form. Applications such as Microsoft Excel and Microsoft Word for Windows have a multiple-document interface.
MDI applications allow users to display multiple documents at the same time, and each document appears in its own window. The document or child window is included in the parent window, and the parent window provides a workspace for all child windows in the application. For example, Microsoft Excel allows you to create and display multiple document windows with different styles. Each child window is restricted within the area of the Excel parent window. When you minimize Excel, all document windows are minimized, and only the icons of the parent window appear in the taskbar. A subform is a normal form with the MDIChild property set to True. An application can contain many similar or different styles of MDI child forms.
At run time, the subform appears within the MDI parent form's workspace (its area is within the parent form's border and under the title and menu bar). When a subform is minimized, its icon appears in the workspace of the MDI form, not in the taskbar, as shown in Figure 6.4.

Note An application can also include standard, non-MDI forms that are not contained within an MDI form. A typical use of a standard form in an MDI application is a dialog box that displays the mode.
An MDI form is similar to a normal form with a restriction condition. You cannot place a control directly on an MDI form unless the control has a Align property, such as a PictureBox control, or has an invisible interface such as a Timer control.

Creating an MDI Application
Use the following procedure to create an MDI form and its subform.
To create an MDI application, follow these steps:
1. Create an MDI form.
Choose Add MDI Form from the Project menu.
Note An application can have only one MDI form. If the project already has an MDI form, the Add MDI Form command on the Project menu is not available.
2. Create the subform of the application.
To create an MDI child form, first create a new form (or open a form that exists), and then set its MDIChild property to True.

Using MDI child forms at design time
At design time, the subform is not restricted within the MDI form region. You can add controls, set properties, write code, and design subform functionality, just as you do in other Visual Basic forms.
You can determine whether a form is an MDI child form by looking at the MDIChild property or by checking the Project Explorer. If the form's MDIChild property is set to True, it is a subform. Visual Basic displays a specific icon for the MDI form and the MDI child form in the Project Explorer, as shown in Figure 6.5.

Figure 6.5 The icons in the Project Explorer indicate MDI child forms, standard forms, and MDI forms

Characteristics of MDI Form runtime
At run time, the MDI form and all of its subforms render a specific property:
1. All subforms are displayed in the working space of the MDI form. Like other forms, users can move the subform and change the size of the subform, but they are limited to that workspace.
2. When you minimize a subform, its icon appears on the MDI form instead of in the taskbar. When you minimize an MDI form, this MDI form and all its subforms are represented by an icon. When you restore an MDI form, the MDI form and all its subforms are displayed in the state before it is minimized.
3. When you maximize a subform, its caption is grouped with the title of the MDI form and displayed on the title bar of the MDI form (see Figure 6.6).

4. By setting the AutoShowChildren property, the subform can automatically display (True) or automatically hide (False) When the form is loaded.
5. The menu (if any) of the active subform appears in the menu bar of the MDI form, not in the subform.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.