views:

166

answers:

2

How can you detect "EXACTLY" when the scroll bar appears, in a UserControl? perhaps an event or something?

+1  A: 

They can only appear when the control is resized or the amount of data in the control increases. Since you get notifications of resize, and adding data is up to you. It's easy to add code to test for the scrollbar in the few places where their visibility can change. There's really no need to have a special notification.

John Knoeller
Iffy, the size of the control doesn't actually change. Only the client size changes. That does generate a Resize event, WF seems to use it to trigger a layout recalc. Not sure if it does so consistently.
Hans Passant
A: 

Thanks for your answers and comments guys, but i ended up using the LayoutChange event, and then just checked if the scrollbars were present or not, (because a layout event is thrown when the scrollbars are shown)

Tommy