Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
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 InitializeFlatSB Lib "comctl32" (ByVal hWnd As Long) As Long
Private Declare Function UninitializeFlatSB Lib "comctl32" (ByVal hWnd As Long) As Long
Private Declare Function FlatSB_SetScrollProp Lib "comctl32" (ByVal hWnd As Long, ByVal index As Long, ByVal newValue As Long, ByVal fRedraw As Boolean) As Boolean
Private Sub Form_Activate()
'Initialize
InitializeFlatSB MSHFlexGrid1.hWnd
FlatSB_SetScrollProp MSHFlexGrid1.hWnd, WSB_PROP_VSTYLE, FSB_ENCARTA_MODE, True
End Sub
Private Sub Form_Load()
Dim Ret As Long
Dim I, J As Integer
MSHFlexGrid1.Cols = 10
MSHFlexGrid1.Rows = 20
For I = 1 To 9
For J = 1 To 19
MSHFlexGrid1.TextMatrix(J, I) = J & "行" & I & "列"
Next
Next I
Ret = GetWindowLong(MSHFlexGrid1.hWnd, GWL_STYLE)
Ret = Ret Or WS_VSCROLL Or WS_HSCROLL
SetWindowLong MSHFlexGrid1.hWnd, GWL_STYLE, Ret
End Sub
Private Sub Form_Unload(Cancel As Integer)
UninitializeFlatSB MSHFlexGrid1.hWnd
End Sub