Question Scrollbars dissappear from ListBox when Form Resized

Subtle

New member
Joined
Jan 5, 2011
Messages
1
Programming Experience
1-3
Hi,

I have an issue with some code that has been written in house at my company.
As this is company code I feel I can't paste an example but I will try and describe the issue as best as I can:

.NET 2.0, Visual Studio 2008

Issue does not appear on XP or Vista, but can be recreated easily on Windows Server 2008 R8, Windows 7

The issue is this....

I have a form which is quite heavily laden with various controls, one of the controls is a listbox which is used to display folders and files contained within a selected directory.

When the number of items in the list goes below the size of the control (when the form is normal sized, i.e. not maximised) then scroll bars appear down the right hand side of the list box and the user can scroll.

If the form is maximised the scrollbars dissappear, which is fine, as the items in the list can all be seen within the bounds of the listbox.

When the form is restored to the original size the scrollbars dissappear even though there are more items in the list box than can be seen.

Now, If I minimise the form to the taskbar and restore to normal the scrollbars reappear.

I have tried adding autoscroll to true and setting the autoscrollmin sizes, but this doesn't work.

I have also tried to call Invalidate() and Refresh() on the parent form and also on the control itself but this doesn't seem to work either.

What I really want to know is, what is it about restoring from the taskbar that repaints the scrollbars that restoring from maximise to normal doesn't?

Is there any code I can call in say the OnResize form method to replicate what is happening when the form is restored from the taskbar?

Any help greatfully appreciated as I have spent ages on this and am getting nowhere fast.

Regards
 
Top Bottom