Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 检查TreeView滚动条的可见性_C#_Winforms_Treeview_Scrollbar - Fatal编程技术网

C# 检查TreeView滚动条的可见性

C# 检查TreeView滚动条的可见性,c#,winforms,treeview,scrollbar,C#,Winforms,Treeview,Scrollbar,如何检查树视图中的垂直滚动条是否可见?必须执行一些p/invoke操作才能获得树视图的样式 private const int GWL_STYLE = -16; private const int WS_VSCROLL = 0x00200000; [DllImport("user32.dll", ExactSpelling = false, CharSet = CharSet.Auto)] private static extern int GetWindowLo

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

必须执行一些p/invoke操作才能获得树视图的样式

    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);
    }

添加更多详细信息,您尝试了什么,您的原始格式是什么,代码。注意:GetWindowLong对于32位和64位执行是不同的。有关此问题的解决方案,请参见此处: