How to cause VB6 to redraw controls in large forms

I've now tried two different grids: itGrid and Spread.  Under some circumstances - and I've not been able to pin down the circumstances - neither of them like redrawing once the window gets above a certain area.  Instead the area inside the control is never redrawn, and retains its previous content.  If the window gets below that size, it starts redrawing again.

I'm running a dual-head 1280x1024 system, and can sometimes cause this behaviour by sizing the control to over c. 75% of the area.  However, it appears that it can *also* be caused by having many smaller windows containing the control.

Once this behaviour starts on a machine, it appears to be impossible to stop.  However, it doesn't necessarily start immediately after installing the app - or, indeed, at all.  Quitting and restarting the app may help, as may rebooting the machine, but neither seems to provide a permanent solution.

Windows 2000 SP4, VB6 SP6, itGrid v2.0.0 (written in VB), Spread v7.0 (written in C++), windows inside MDI.

All ideas welcome!

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If the problem exists on both grid controls, then it is unlikely to be an issue regarding the controls.  Perhaps it is related to the display driver.  Have you tried running the code on another machine to see if the problem is machine specific?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Joachim CarreinSr. Software DeveloperCommented:
set the autoredraw option of the form to True and check what this gives
MelandraAuthor Commented:
Erick37 - this has previously been seen on another machine (the client's test machine, worse luck!).  Also, and interestingly, Tidestone F1 doesn't seem to exhibit the behaviour when used as a control.

Joachim - that appears to fix the issue based on some rapid testing on my developer machine.  *However*, once I then turn *off* the change, it appears to still work.  As you can probably imagine, this worries me!  Update... when I close and re-open the VB6 development environment, the problem is back.

Any more feedback, gentlemen?  With that behaviour from VB, I'm now even more confused than I was when I started!
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Does this happen if the grid is a static size, or only if it is resized during runtime?

You could force the grid to update in the Paint event of the form:

'Autoredraw must be False to receive Paint events.


    Grid.Refresh or Grid.Repaint '<<--whatever your grid supports
MelandraAuthor Commented:
Erick, many thanks for the continued interest in what may well be an isolated problem.

The windowstate is currently set to Maximized in the form design view; that can lead to the failure described.  Resizing during runtime can certainly lead to it.  Interestingly, the form appears to open at normal size then maximise, *despite* the WindowState being Maximized.  No other code is changing the WindowState during this time.

Forcing a refresh in Paint (and, yes, I've put the debugger on it and proved it's being called ;-) ) does not change the behaviour.

For extra chaos, the AutoRedraw 'solution' no longer works either - although the mainifestation of the failure changes slightly depending on whether or not I have Visual Studio 2003 also open on my machine.  With it open, nothing paints except the scrollbars of the normal-sized window.  With it closed, the grid paints in the normal-sized window, then the maximise happens and the repaint fails.  Pick the bones out of that if you can!

I'm reduced to wondering whether I have gremlins in my machine or operating system - I'm going to try this on another box.  Will post here once I have some more data points.

- Peter
MelandraAuthor Commented:
This appears to be specific to my development machine; I have tried it on a number of single- and dual-screen boxes, and no other machine appears to exhibit this behaviour.  For this reason, I'm accepting Erick37's recommendation to examine display drivers on the machine even though it did not directly solve the problem; certainly, for anyone else viewing this question, I would suggest testing on other machines early and finding out whether it is a problem, rather than continuing to test on your own machine.  You will save yourself considerable time!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.