Browse DevX
Sign up for e-mail newsletters from DevX


Designing Complex Interfaces in VB

Enhance your SDI interfaces using MDI techniques to build scrolling forms with menus that merge automatically depending on which form is visible.

arge scale applications should have a consistent look and feel, a consistent interface, and a menu structure that reflects the basic operations of the application. Typically, each form's menu contains the operations that can be performed on the current form; however large cohesive applications may contain a large number of forms. Rather than having unique menus for each form, you're better off designing a menu structure that accommodates both application tasks common to all forms, and the unique menu items that apply to the currently active form. That's what MDI menus do—each form's menu merges with the application's menu structure so that the user sees a single menu bar that adapts to the tasks available on the active form.

VB and Scrolling Forms
One of the shortcomings of standalone VB forms is that they aren't scrollable. When users reduce the size of a form to make room for other forms on the desktop, rather than scrollbars appearing, the usually some controls get hidden. Users then have to restore the form to its original size to view all the controls on it. To solve the hidden control problem, developers sometimes insert code in the form's Resize event handler to prevent users from resizing the form below a predetermined threshold. In addition, there's no simple mechanism to attach scrollbars to the form, so that users can scroll to the desired section of the form. This isn't much of a problem with most typical business applications, but it's a necessity with graphics applications, or applications with large amounts of text.

The .NET framework addresses both of these problems by exposing some new properties available from the Form Designer in Visual Studio.NET to choose how forms display scrollbars and to set a form's minimum size. To prevent users from resizing a form, you must set the form's minimum width and height from within the form's Resize event handler. A better solution for many applications is to cause the form to scroll if the user resizes it so that not all the important content is visible.

The simplest way to implement a scrolling form in VB is to create the form as a child form of a parent MDI form. If you create an MDI child form that covers the entire parent form's client area and the user resizes the parent form so that the child form isn't entirely visible, the VB runtime automatically attaches scrollbars to the parent form—effectively letting you scroll the content. You can exploit this behavior of MDI forms to build scrollable forms.

Many business applications need multiple forms, but building (MDI) applications isn't always the best solution. Users often prefer Single Document Interface (SDI) applications. To build these complex SDI interfaces, you need to be able to create scrolling forms with menus that merge.

Visual Basic doesn't support standalone scrolling forms directly, nor does it support menu merges for standalone formsbut it supports both concepts for MDI child forms. You can take advantage of that support by using MDI techniques to create complex SDI interfaces.

Thanks for your registration, follow us on our social networks to keep up-to-date