使用API函数:
声明
声明
FUNCTION ulong ShowScrollBar(ulong
hwnd,ulong wBar,ulong bShow) LIBRARY "user32.dll"
调用
constant long SB_HORZ = 0
constant long SB_VERT
= 1
constant long
SB_BOTH = 3
ShowScrollBar(Handle(TreeView1),SB_HORZ,0);//隐藏水平滚动条
ShowScrollBar(Handle(TreeView1),SB_VERT,0);//隐藏垂直滚动条
ShowScrollBar(Handle(TreeView1),SB_BOTH,0);//隐藏所有滚动条
//去掉TreeView水平滚动条
ShowScrollBar(TreeView1.handle,0,False) ;
还有一种方法,也是API:
定义两个实例常量
constant int GWL_STYLE = -16
constant uLONG TVS_NOHSCROLL = 32768
定义两个外部函数声明
Function long GetWindowLong (ulong hWnd, int nIndex) Library "USER32.DLL " Alias for "GetWindowLongA "
Function long SetWindowLong (ulong hWnd, int nIndex, long dwNewLong) Library "USER32.DLL " Alias for "SetWindowLongA "
在程序中按照以下方法写
long ll_TVStyle
ll_TVStyle = GetWindowLong(Handle(tv_1),GWL_STYLE)
ll_TVStyle += TVS_NOHSCROLL
SetWindowLong(Handle(tv_1),GWL_STYLE,ll_TVStyle)
定义两个实例常量
constant int GWL_STYLE = -16
constant uLONG TVS_NOHSCROLL = 32768
定义两个外部函数声明
Function long GetWindowLong (ulong hWnd, int nIndex) Library "USER32.DLL " Alias for "GetWindowLongA "
Function long SetWindowLong (ulong hWnd, int nIndex, long dwNewLong) Library "USER32.DLL " Alias for "SetWindowLongA "
在程序中按照以下方法写
long ll_TVStyle
ll_TVStyle = GetWindowLong(Handle(tv_1),GWL_STYLE)
ll_TVStyle += TVS_NOHSCROLL
SetWindowLong(Handle(tv_1),GWL_STYLE,ll_TVStyle)