Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check TreeView ScrollBar Visibility

How can i check if the Vertical ScrollBar in a TreeView is Visible?

like image 777
Adrao Avatar asked Mar 26 '13 22:03

Adrao


1 Answers

You must do some p/invoke to get the style of 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);
    }
like image 60
albert Avatar answered Oct 03 '22 14:10

albert