你的textbox是在点击网络时定的位吧?
那么在click事件中取得当时msflexgrid的toprow与row值,row-toprow就是你当前在网格上显示的行数假设为NRow
scroll事件里再取topr+Nrow,就是滚动后应该显示的行数了
如:
dim nRow as integer
private sub msflexgrid_click()
nrow=msflexgrid.row-msflexgrid.toprow
end sub
private sub msflexgrid_scroll()
msflexgrid.row=mflexgrid.toprow+nrow
text1.move msflexgrid.left+msflexgrid.cellleft,msflexgrid.top+msflexgrid.cellTop,
msflexgrid.cellwidth,msflexgrid.cellheight
end sub
Private Type SCROLLINFO
cbSize As Long
fMask As Long
nMin As Long
nMax As Long
nPage As Long
nPos As Long
nTrackPos As Long
End Type
Private Declare Function GetScrollInfo Lib "user32" (ByVal hWnd As Long, ByVal n As Long, lpScrollInfo As SCROLLINFO) As Long
Private Sub MSFlexGrid1_Scroll()
Dim SInfo As SCROLLINFO
SInfo.cbSize = LenB(SInfo)
SInfo.fMask = SIF_ALL
Call GetScrollInfo(Me.MSFlexGrid1.hWnd, SBS_VERT, SInfo)
Debug.Print SInfo.nPos
End Sub