FIX: Double-Click Still Maximizes/Restores If MaxButton=FalseLast reviewed: October 30, 1997Article ID: Q110309 |
2.00
WINDOWS
kbprg kbbuglist
The information in this article applies to:
SYMPTOMSSetting the MaxButton property of a form to False removes the Maximize item in the Control-menu box and removes the maximize button in the upper right corner of the form. However, double-clicking the title-bar still maximizes the form or toggles back to the default size. The Control-menu box is also known as the System-menu box in other products for Windows.
CAUSEBy default, double-clicking the title bar has the same effect as choosing Maximize or Restore from the Control-menu box -- it acts as a toggle between the normal window size and the maximized window size. This behavior is by design in standard Microsoft Windows. Setting the MaxButton property of the form to False fails to suppress this behavior in Visual Basic version 2.0.
WORKAROUNDTo prevent a double-click on the title bar from causing Maximize or Restore, call Windows API functions as shown in the sample program in the More Information section below.
STATUSMicrosoft has confirmed this to be a problem in Visual Basic version 2.0 for Windows. This problem was corrected in version 3.0. In version 3.0, setting the form's MaxButton property to False correctly ignores double- clicks on the title bar.
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+EscThese are numbered 0 through 8 from the top down. You may remove any or all entries. Be sure to remove items in reverse sequence, from 8 to 0, or else the numbering will become confused. NOTE: To remove the Control-menu box, set the ControlBox property to False. To remove the minimize button, set the MinButton property to False. To remove the maximize button, set the MaxButton property to False.
Steps to Work Around the BehaviorThe following program removes the Maximize feature from a Visual Basic form. This code can be used in Visual Basic versions 2.0 and 3.0.
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. NOTE: In the above program, the following Form properties should be left with their design-time default: ControlBox = True, MaxButton = True, MinButton = True. The API functions take care of any necessary property changes.
REFERENCES
|
Additional reference words: buglist2.00 fixlist3.00 2.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |