ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1TrueDBGrid.FetchScrollTips Event

Occurs whenever the grid has focus and the scrollbar thumb is moved using the mouse.

[Visual Basic]

Public Event FetchScrollTips As FetchScrollTipsEventHandler

[C#]

public event FetchScrollTipsEventHandler FetchScrollTips

[Delphi]

public property FetchScrollTips: FetchScrollTipsEventHandler read remove_FetchScrollTips write add_FetchScrollTips;

Remarks

If the ScrollTips property is True, the FetchScrollTips event will be raised whenever the grid has focus and the scrollbar thumb is moved using the mouse.

By setting the properties of the FetchScrollTipsEventArgs.TipStyle object, control the background color, text color, and font of the pop-up text box. By default, the FetchScrollTipsEventArgs.TipStyle object uses the system ToolTip colors and the font attributes of the current split.

Example

The following code displays horizontal and vertical scroll bars:

·      Visual Basic

       Private Sub C1TrueDBGrid1_FetchScrollTips(ByVal sender As System.Object, ByVal e As C1.Win.C1TrueDBGrid.FetchScrollTipsEventArgs) Handles C1TrueDBGrid1.FetchScrollTips

           ' Set the ScrollTip depending on which scroll bar was moved.

           Select Case e.ScrollBar

               Case C1.Win.C1TrueDBGrid.ScrollBarEnum.Horizontal

                   e.ScrollTip = Me.C1TrueDBGrid1.Columns(e.ColIndex).Caption

               Case C1.Win.C1TrueDBGrid.ScrollBarEnum.Vertical

                   e.ScrollTip = "Record: " & CStr(e.Row + 1) & " of " & CStr(Me.dbTable.Rows.Count) & vbCrLf & "Company: " & Me.dbTable.Rows(e.Row).Item("Company") & vbCrLf & "User code: " & Me.dbTable.Rows(e.Row).Item("UserCode")

           End Select

           e.TipStyle.ForeColor = Color.Blue

       End Sub

·      C#

       private void C1TrueDBGrid1_FetchScrollTips(System.object sender, C1.Win.C1TrueDBGrid.FetchScrollTipsEventArgs e)

       {

           // Set the ScrollTip depending on which scroll bar was moved.

           switch (e.ScrollBar)

           {

               case C1.Win.C1TrueDBGrid.ScrollBarEnum.Horizontal:

                   e.ScrollTip = this.C1TrueDBGrid1.Columns[e.ColIndex].Caption;

                   break;

               case C1.Win.C1TrueDBGrid.ScrollBarEnum.Vertical:

                   e.ScrollTip = "Record: " + (e.Row + 1).ToString() + " of " + this.dbTable.Rows.Count.ToString() + "\n" + "Company: " + this.dbTable.Rows[e.Row]["Company"].ToString() + "\n" + "User code: " + this.dbTable.Rows[e.Row]["UserCode"].ToString();

                   break;

           }

           e.TipStyle.ForeColor = Color.Blue;

       }

·      Delphi

       procedure C1TrueDBGrid1_FetchScrollTips(sender: System.Object; e: C1.Win.C1TrueDBGrid.FetchScrollTipsEventArgs);

       var

         Row: Integer;

       begin

         // Set the ScrollTip depending on which scroll bar was moved.

         case e.ScrollBar of

           C1.Win.C1TrueDBGrid.ScrollBarEnum.Horizontal:

             e.ScrollTip := c1TrueDBGrid1.Columns[e.ColIndex].Caption;

           C1.Win.C1TrueDBGrid.ScrollBarEnum.Vertical:

             begin

               Row := e.Row + 1;

               e.ScrollTip := 'Record: ' + Row.ToString + ' of ' + dbTable.Rows.Count.ToString + #10#13 + 'Company: ' + dbTable.Rows[e.Row]['Company'].ToString + #10#13 + 'User code: ' + dbTable.Rows[e.Row]['UserCode'].ToString;

             end;

         end;

         e.TipStyle.ForeColor := Color.Blue;

       end;

See Also

C1TrueDBGrid Class | C1TrueDBGrid Members | C1.Win.C1TrueDBGrid Namespace


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.