How to make DeferWindowPos work for VB6 ActiveX controls?

150 views Asked by At

We have a legacy ActiveX grid control built in VB6. In one of our usage scenario, we would like to resize it alongside with other intrinsic VB6 controls like PictureBox using the 'cached window redrawing' functionality provided by the WinAPI DeferWindowPos call. This technique works like a charm for all form controls except our ActiveX. The main problem is that the control is resized as expected, but its contents aren't redrawn. It seems, it remains the same, i.e. its effective size isn't changed.

The MS Spy++ utility reports that the control's window is changed, but if we access the control's Width or Height native VB properties, they remain the same as if the control was not resized at all!

The question is: how to reflect the changes made by DeferWindowPos to the VB Width and Height properties of a custom ActiveX control?

One of the possible idea is that we need to process some special native window messages like WM_WINDOWPOSCHANGING inside our ActiveX and call the appropriate UserControl.Extender methods or properties, but it seems in this case we lose the benefit of the DeferWindowPos call as in fact we call the good old VB6 Move method of the control...

0

There are 0 answers