How to Remove Menu Items from a Form's Control-Menu BoxLast reviewed: February 18, 1996Article ID: Q110393 |
The information in this article applies to:
- Standard and Professional Editions of Microsoft Visual Basic for Windows, version 3.0
SUMMARYThe Control-menu box is located in the upper-left corner of a Visual Basic form. You can remove certain menu items from the Control-menu box by using the using form's MaxButton, MinButton, and BorderStyle properties. You can also remove Control-menu items by using Windows API functions, as shown in a sample program in the More Information section below. To completely remove the Control-menu box, set the form's ControlBox property to False.
MORE INFORMATIONThe default Control-menu box in the upper left-hand corner of a Visual Basic form contains the following nine entries, including separators:
Restore Move Size Minimize Maximize ----------------------- Close Alt+F4 ----------------------- Switch to... Ctrl+EscYou can remove certain menu items from the Control-menu box by using a form's MaxButton, MinButton, and BorderStyle properties: MaxButton property: Setting the MaxButton property to False at design time removes the Maximize item in the Control-menu box and also removes the Maximize arrow in the upper right corner of the form. Setting MaxButton to be False also prevents a double-click on the title bar from maximizing the form. MinButton property: Setting the MinButton property to False at design time removes the Minimize item in the Control-menu box and also removes the minimize arrow in the upper right corner of the form. BorderStyle property:
Setting Description ---------------------------------------------------------------------- 0 No border and no related border elements. 1 Fixed Single. Can include Control-menu box, title bar, Maximize button, and Minimize button. Resizable only using Maximize and Minimize buttons. 2 (Default) Sizable. Resizable using any of the optional border elements listed for setting 1. 3 Fixed Double. Can include Control-menu box and title bar; cannot include Maximize or Minimize buttons. Not resizable. Example Uses API Functions to Remove Control-Menu ItemsThe following program invokes Windows API functions to remove all items in the Control-menu box except for Restore and Minimize.
Clicking the Minimize arrow or choosing the Minimize menu item minimizes the form to an icon. A single-click on that icon does not open a control- menu, unlike normal Visual Basic application icons. A double-click is required to restore the form to its full-screen state.
Creating a Form with No Title BarTo create a Microsoft Visual Basic for Windows form with a border but with no title bar, the Caption property of a form must be set to a zero-length string; the BorderStyle property must be set to Fixed Single (1), Sizable (2) or Fixed Double; and the ControlBox, MaxButton and MinButton properties must be set to False (0). If any text (including spaces) exists for the Caption property or if the ControlBox, MaxButton, or MinButton property is set to True, a title bar will appear on the form. Note that setting the BorderStyle property to None (0) will always make a form with no title bar.
REFERENCES
|
Additional reference words: 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |