Second Line of Menu Bar Not Repainted in VB Under Windows 3.1

ID Number: Q84472

1.00

WINDOWS

buglist1.00

Summary:

If you create menu items for the menu bar of a form such that they

wrap to a second line, that second line and any subsequent line may

not be repainted after being covered by an overlapping window. This

problem occurs only after the form with the menu has been moved from

its original location. This occurs in VB.EXE in both design mode and

run mode under Windows 3.1. The problem does not occur under Windows

3.0.

Microsoft has confirmed this to be problem with Microsoft Visual Basic

programming system version 1.0 for Windows under Microsoft Windows

version 3.1. We are researching this problem and will post new

information here as it becomes available.

More Information:

Steps to Reproduce Problem

--------------------------

1. Run Visual Basic, or from the File menu, choose New Project (ALT,

F, N) if Visual Basic is already running. Form1 is created by

default.

2. From the Window menu, choose Menu Design Window.

3. Create ten different menu items, all at the top level (do not

indent any).

4. Close the Menu Design Window dialog box.

5. If the Menu bar on the form has not wrapped to multiple lines,

shrink the width of the form until you get at least two lines of

menu items.

6. Select another Window or form from any other application. Bring it

over the top of the menu area of Form1.

7. Remove the form or window so you can see the menu area. This

should repaint properly.

8. Now Move Form1 to a new location even moving it one pixel will do.

9. Repeat steps 6 and 7.

Note that the Menu area below the first line is not repainted

properly. It contains the image that was previously there. Note

also that along the first menu line it looks as if all the menu

items were put on one line. You may see a clipping of a menu item

on the far right, which was previously on the second line.

Workaround

----------

To work around this problem, you need only issue a command that will

cause a repaint in the menu bar. Assigning a value to the caption

property of a menu item will do this. You do not need to change the

caption, just assign it the same value. A good time to do this is

whenever the form receives a paint message.

In the Form1 Paint event procedure, add the following code,

which will set the Caption of a menu item with the CtrlName Menu1:

Form1_Paint

Form1.Menu1.Caption = Form1.Menu1.Caption

End Sub

This will force the menu bar to be repainted whenever the form is

repainted. This will also cause a brief flicker in the menu bar

region.

Additional reference words: 1.00 3.10