How can I get the height of horizontal and/or width of vertical scrollbar that appears on control (e.g. DataGridView)?
3 Answers
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
.
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