开发者

Programmatically select ComponentOne TrueDBGrid Filterbar

I'm using a ComponentOne TrueDBGrid control, with the filterbar enabled. I'd like to modify the the default behaviour so that when a cell in the filterbar is clicked, the text in that cell is automatically selected. Normally I'd wireup a MouseDown event and use the CellContaining method to check which cell has been clicked, but this only ever returns开发者_运维技巧 -1 for both row and col for the filterbar. So I can't identify an individual cell, and I don't know how to select a particular cell in the filterbar.

Does anyone have any suggestions how I might do this?


Posting solution in case anyone else runs into this problem.

You need to capture kind of grid element beneath the coordinate you clicked on, using PointAtEnum. Then you may simply set the cell in EditMode by setting the grid’s EditActive property to True. And this is how you do it at MouseUp event:

Private Sub C1TrueDBGrid1_MouseUp(sender As Object, _
               e As System.Windows.Forms.MouseEventArgs) _
                  Handles C1TrueDBGrid1.MouseUp

If Me.C1TrueDBGrid1.PointAt(e.X, e.Y) = _
    C1.Win.C1TrueDBGrid.PointAtEnum.AtFilterBar Then
    Me.C1TrueDBGrid1.EditActive = True
End If

End Sub
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜