Disabled but visible Scrollbars in ScrollableControl

W

Wells Caughey

Hello Everyone,

I have a class that is derived from ScrollableControl and does custom
painting. My problem is that when ever the DisplayRectangle's Size exceedes
the AutoScrollMinSize the scrollbars actually disappear which messes up my
custom layout logic. What I want is to keep the vertical scroll bar visible
regardless of the DisplayRectangle's relationship to the AutoScrollMinSize.
Specifically I want the vertical scrollbar to remain visible but appear
disabled when the DisplayRectangle exceedes the AutoScrollMinSize.

As an additional constraint, the application that hosts this control is not
given Full Privildeges so I can not use any form of interop.

Thanks,
Wells
 
Y

Ying-Shen Yu[MSFT]

Hi Wells,

The ScrollableControl uses WS_HSCROLL/WS_VSCROLL windows style to draw the
scrollbars, so there are actually no Scrollbar controls in it. They are not
really windows, I can't think of a way to disable them in managed code
(even in native code).

To override the default behavior, you need create a usercontrol (set
AutoScroll = false) with Horizontal and Vertical scrollbar controls to
simulate the ScrollableControl,

Does this help to your problem?
Please feel free to let me know if you still have problem on it.

Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 
W

Wells Caughey

Hi Ying-Shen,

Thank you for replying to my message. Since I posted that message I had
tried a number of workarounds and finally I got one to stick (though I don't
really know why). Since it now works, I think I'll just leave it alone. It
would have been nice to have disabled scrollbars, but so long as the layout
logic works, its not required.

Thanks,
Wells
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top