如何获取 DataGridView 控件上滚动条的大小?

发布于 2024-10-08 03:22:27 字数 56 浏览 8 评论 0原文

如何获取控件(例如 DataGridView)上出现的水平滚动条的高度和/或垂直滚动​​条的宽度?

How can I get the height of horizontal and/or width of vertical scrollbar that appears on control (e.g. DataGridView)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

找回味觉 2024-10-15 03:22:28

DataGridView 上显示的滚动条将与计算机上的所有其他滚动条具有相同的水平高度和垂直宽度。这些大小由活动 Windows 主题定义,并由 .NET Framework 在 SystemInformation

同一类还提供有关当前系统环境中默认滚动条参数的附加信息。

如果您需要知道哪些滚动条当前在控件上可见,请使用其ScrollBars 属性。这获取或设置 ScrollBars 值,可以是水平垂直两者

The scrollbars that appear on your DataGridView will be the same horizontal height and vertical width as all of the other scrollbars on your computer. These sizes are defined by the active Windows theme, and exposed by the .NET Framework in the following properties of the SystemInformation class:

The same class also provides additional information about the default scrollbar parameters in the current system environment.

If you need to know which scrollbars are currently visible on your control, use its ScrollBars property. This gets or sets one of the ScrollBars values, either None, Horizontal, Vertical, or Both.

葬シ愛 2024-10-15 03:22:28

将其放入资源字典中:

<xcdg:DataGridControl >
<xcdg:DataGridControl.Resources>
<Style TargetType="{x:Type xcdg:TableViewScrollViewer}">
<Setter Property="VerticalScrollBarVisibility" Value="Hidden" />
</Style>
</xcdg:DataGridControl>

检查一下:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.scrollbars.aspx

无论 的值如何通过此属性,滚动条仅在需要时才显示。使用此属性可以防止出现滚动条。例如,当您想要提供用于滚动的替代用户界面 (UI) 时,这很有用。

http://msdn.microsoft.com/en-us /library/system.windows.forms.scrollbars.aspx

Place this in your resource dictionary:

<xcdg:DataGridControl >
<xcdg:DataGridControl.Resources>
<Style TargetType="{x:Type xcdg:TableViewScrollViewer}">
<Setter Property="VerticalScrollBarVisibility" Value="Hidden" />
</Style>
</xcdg:DataGridControl>

check this out:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.scrollbars.aspx

Regardless of the value of this property, scroll bars are shown only when they are needed. Use this property to prevent scroll bars from appearing. This is useful, for example, when you want to provide an alternative user interface (UI) for scrolling.

http://msdn.microsoft.com/en-us/library/system.windows.forms.scrollbars.aspx

愁以何悠 2024-10-15 03:22:27

使用:

SystemInformation.HorizontalScrollBarHeight;
SystemInformation.VerticalScrollBarWidth;

Use:

SystemInformation.HorizontalScrollBarHeight;
SystemInformation.VerticalScrollBarWidth;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文