开发者

Deriving from a ScrollableControl, is there a way to always have the horizontal scrollbar visible?

开发者 https://www.devze.com 2022-12-10 13:27 出处:网络
Having a custom control deriving from ScrollableControl and using AutoScrollMinSize to set the inner display bigger than the viewport, the horizontal scrollbar shows as expected.

Having a custom control deriving from ScrollableControl and using AutoScrollMinSize to set the inner display bigger than the viewport, the horizontal scrollbar shows as expected.

However, sometimes I want the inner display smaller than the viewport but开发者_如何学编程 the horizontal scrollbar disappears. I know that's the expected behavior but what I would like is for the scrollbar to be there but kind of disabled or full.

Is there a way to achieve this?


You could make a panel or label that is 1 pixel wider than your ScrollableControl, anchor it to the right and left so that it stays wider, and make it 0 or 1 pixels tall so that people don't notice it. It's an ugly hack, but it should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号