检查TreeView滚动条可见性
本文关键字:可见性 滚动条 TreeView 检查 | 更新日期: 2023-09-27 18:06:05
如何检查垂直滚动条在TreeView中是否可见?
你必须做一些p/invoke来获得TreeView的样式。
private const int GWL_STYLE = -16;
private const int WS_VSCROLL = 0x00200000;
[DllImport("user32.dll", ExactSpelling = false, CharSet = CharSet.Auto)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
bool VScrollVisible()
{
int style = GetWindowLong(myTreeView.Handle, GWL_STYLE);
return ((style & WS_VSCROLL) != 0);
}