FIX: Grid Control Repaints When Another Form Is Made Active

ID: Q100195

3.00 WINDOWS kbprg kbbuglist

The information in this article applies to:

- Microsoft Visual Basic programming system for Windows, version 3.0

SYMPTOMS

If you activate another form while a form containing a Grid control is showing, the Grid repaints itself.

CAUSE

When the grid loses focus, it automatically repaints the entire grid. The grid should only paint the section of the grid that was covered or changed -- not the entire grid -- when it loses focus.

WORKAROUND

There is no known workaround at this time.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been corrected in Visual Basic version 4.0.

MORE INFORMATION

Steps to Reproduce Problem

1. Start 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 File menu, choose Add File (ALT, F, A) and add GRID.VBX to
   the project and add a grid (Grid1) control to Form1.

3. From the File menu, choose New Form (ALT F, F). Form2 is created.

4. Add the following code to the Form_Load event procedure of Form1:

   Sub Form_Load ()

      Grid1.Rows = 20
      Grid1.Cols = 8

      'Initialize the grid with random data
      For I = 0 To 19
         Grid1.Row = I
         For J = 0 To 7
            Grid1.Col = J
            Grid1.Text = Format$(I) + Format$(J)
         Next J
      Next I

      Form2.Show

   End Sub

5. From the Run menu, choose start (ALT, R, S) or press F5.

6. Position Form2 to cover a portion of the grid, click back and forth

   between the two forms, and notice that the grid is repainted each time
   Form2 is activated.

Additional reference words: buglist3.00 3.00 fixlist4.00 KBCategory: kbprg kbbuglist KBSubcategory: PrgCtrlsCus
Keywords          : PrgCtrlsCus kbbuglist
Version           : 3.00
Platform          : WINDOWS
Solution Type     : kbfix

Last Reviewed: November 1, 1997