正如您所知,可以在“显示属性”->“外观”->“高级”->“项目:滚动条”的选项中自定义滚动条的宽度,默认值为17。然而,我不能假设这总是正确的,有可能吗我检索此值?
查看 System.Windows.Forms.SystemInformation
类的成员:HorizontalScrollBarHeight
和 VerticalScrollBarWidth
。
垂直滚动条宽度
System.Windows.Forms.SystemInformation.VerticalScrollBarWidth;
ScrollableControl
的大小减去滚动条的大小,最简单的方法是使用 Control.ClientSize
属性。