vb6如何知道msflexgrid_scroll向上向下单击

发布于 2024-11-26 13:39:59 字数 71 浏览 1 评论 0原文

当单击向下箭头上的 msflexgrid 滚动条时,我如何知道我已单击向下箭头。如果可能的话给我示例代码。

谢谢

when clicking on the msflexgrid scroll bar on the down arrow, how can i know that i have clicked on the down arrow. give me sample code if possible.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云裳 2024-12-03 13:39:59

取决于您想要它的用途(这定义了您需要它的具体程度)。您可以使用 Scroll 事件判断网格何时成功滚动:

Private Sub MSFlexGrid1_Scroll()

    Debug.Print "Scrolled"

End Sub

如果您需要区分向下和向上(以及单个移动和较大的条形单击移动),则必须跟踪顶行:

Option Explicit
Public GridTop As Long

Private Sub Form_Load()
Dim lA As Long

    MSFlexGrid1.Cols = 4
    MSFlexGrid1.Clear
    For lA = 1 To 20
        MSFlexGrid1.AddItem lA & vbTab & "bob-" & lA & vbTab & lA & "-fred" & vbTab & lA & "-joe-" & lA
    Next lA
    MSFlexGrid1.RemoveItem 1
    GridTop = MSFlexGrid1.TopRow

End Sub

Private Sub MSFlexGrid1_Scroll()

    Debug.Print "Scrolled"
    Debug.Print MSFlexGrid1.TopRow
    If MSFlexGrid1.TopRow = GridTop + 1 Then
        Debug.Print "Down arrow (effective)"
    End If
    GridTop = MSFlexGrid1.TopRow

End Sub

如果您实际上需要知道何时具体单击了向下箭头,无论它是否实际滚动网格,现在您都进入了子类化。试试这个:

http://www.planetsourcecode.com/ vb/scripts/ShowCode.asp?txtCodeId=59656&lngWId=1

只需在示例项目中将 flexgrid 替换为 rtfExample -我尝试了一下,似乎效果很好。

Depends on what you want it for (which defines how specific you need it to be). You can tell when the grid has been scrolled successfully with the Scroll event:

Private Sub MSFlexGrid1_Scroll()

    Debug.Print "Scrolled"

End Sub

If you need to distinguish down from up (and a single move from a larger bar-click move), you'll have to keep track of the top row:

Option Explicit
Public GridTop As Long

Private Sub Form_Load()
Dim lA As Long

    MSFlexGrid1.Cols = 4
    MSFlexGrid1.Clear
    For lA = 1 To 20
        MSFlexGrid1.AddItem lA & vbTab & "bob-" & lA & vbTab & lA & "-fred" & vbTab & lA & "-joe-" & lA
    Next lA
    MSFlexGrid1.RemoveItem 1
    GridTop = MSFlexGrid1.TopRow

End Sub

Private Sub MSFlexGrid1_Scroll()

    Debug.Print "Scrolled"
    Debug.Print MSFlexGrid1.TopRow
    If MSFlexGrid1.TopRow = GridTop + 1 Then
        Debug.Print "Down arrow (effective)"
    End If
    GridTop = MSFlexGrid1.TopRow

End Sub

If you actually need to know when you've clicked the down-arrow specifically, whether or not it actually scrolls the grid, now you're into subclassing. Try this:

http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=59656&lngWId=1

Just swap out a flexgrid for rtfExample in the sample project - I tried it, seems to work fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文