Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to cause VB6 to redraw controls in large forms

Posted on 2004-11-16
8
Medium Priority
?
1,355 Views
Last Modified: 2008-03-04
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!

Peter
0
Comment
Question by:Melandra
  • 3
  • 3
7 Comments
 
LVL 32

Accepted Solution

by:
Erick37 earned 1500 total points
ID: 12596809
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?
0
 
LVL 4

Expert Comment

by:Joachim Carrein
ID: 12602622
set the autoredraw option of the form to True and check what this gives
0
 
LVL 1

Author Comment

by:Melandra
ID: 12602749
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!
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 32

Expert Comment

by:Erick37
ID: 12604315
Does this happen if the grid is a static size, or only if it is resized during runtime?

0
 
LVL 32

Expert Comment

by:Erick37
ID: 12604343
You could force the grid to update in the Paint event of the form:

'Autoredraw must be False to receive Paint events.

Form_Paint()

    Grid.Refresh or Grid.Repaint '<<--whatever your grid supports
0
 
LVL 1

Author Comment

by:Melandra
ID: 12613328
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
0
 
LVL 1

Author Comment

by:Melandra
ID: 12817634
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!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question