首先listbox要有WS_HSCROLL风格,如VB中没有相应的设置,可调用WIN32API SetWindowLong设置风格,然后按Un1所说的方法做就可以了。
const GWL_STYLE as long=-16
const WS_HSCROLL as long=&h100000
dim lstyle as long
dim t as long
lstyle=GetWindowLong(list1.hwnd,GWL_STYLE)
t=lstyle/WS_HSCROLL
if t/2*2=t then SetWindowLong list1.hwnd,GWL_STYLE,lstyle+WS_HSCROLL