tags:

views:

33

answers:

1

I have a panel and I set AutoScrollMinSize. I also call Invalidate() on the panel in order to force a paint. The size of the panel is less than the size of the AutoScrollMinSize values, yet the control does not display the scroll bars until I mouse over the panel.

What would cause this behavior, or how can I have the AutoScrollMinSize take effect immediately?

+1  A: 

It could be because the control isn't redraw right away (which makes sense in this case).

You could instead call Refresh() on the control. Refresh() forces the control to be invalid and send a WM_PAINT message immediately. Invalidate() on the other hand basically says "ok the control is invalid...it will redraw with the next WM_PAINT".

EDIT: Here's a link for more information.

TheCloudlessSky