5

如何检查 TreeView 中的垂直滚动条是否可见?

4

1 回答 1

9

你必须做一些 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);
    }
于 2013-03-26T22:49:44.120 回答