最好在窗体上画上滚动条控件(HScrollbar(横向滚动条)和VScrollbar(纵向滚动条)),设置好有关属性即可,不会用的话,可以留言如果用api的话,用下面的代码就可以显示滚动条: Option Explicit Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Const WS_HSCROLL = &H100000 Private Const WS_VSCROLL = &H200000 Private Const GWL_STYLE = (-16)Private Sub Form_Load() Dim style As Long style = GetWindowLong(Me.hwnd, GWL_STYLE) style = style Or WS_HSCROLL style = style Or WS_VSCROLL SetWindowLong Me.hwnd, GWL_STYLE, style Me.Width = Me.Width + 10 '强制窗体刷新,也可用setwindowpos刷新窗体 Me.Width = Me.Width - 10 End Sub不过,显示出来的滚动条只能看不能用,事实上你应该在子类中响应有关消息,可以参考:http://wy_xl.y365.com/tec/form/5.htm 显示窗口的水平和垂直滚动条好好看看,代码我就不贴了:)
Option Explicit
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const WS_HSCROLL = &H100000
Private Const WS_VSCROLL = &H200000
Private Const GWL_STYLE = (-16)Private Sub Form_Load()
Dim style As Long
style = GetWindowLong(Me.hwnd, GWL_STYLE)
style = style Or WS_HSCROLL
style = style Or WS_VSCROLL
SetWindowLong Me.hwnd, GWL_STYLE, style
Me.Width = Me.Width + 10 '强制窗体刷新,也可用setwindowpos刷新窗体
Me.Width = Me.Width - 10
End Sub不过,显示出来的滚动条只能看不能用,事实上你应该在子类中响应有关消息,可以参考:http://wy_xl.y365.com/tec/form/5.htm
显示窗口的水平和垂直滚动条好好看看,代码我就不贴了:)