windowsforms-devexpress-dot-xtragrid-dot-views-dot-grid-dot-gridview-7c8e25a4.md
Allows you to specify custom annotations.
Namespace : DevExpress.XtraGrid.Views.Grid
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
[DXCategory("Events")]
public event EventHandler<GridCustomScrollAnnotationsEventArgs> CustomScrollAnnotation
<DXCategory("Events")>
Public Event CustomScrollAnnotation As EventHandler(Of GridCustomScrollAnnotationsEventArgs)
The CustomScrollAnnotation event's data class is DevExpress.XtraGrid.Views.Grid.GridCustomScrollAnnotationsEventArgs.
The CustomScrollAnnotation event allows you to provide data about required custom annotations. Data is represented by the GridScrollAnnotationInfo type that exposes the following properties:
RowHandle — handle of the required row (see Row handles in the Rows topic);Color — color of the mark on the scrollbar.When handling the CustomScrollAnnotation event, explicitly initialize the e.Annotations collection, create data objects, and add them to the collection.
using using DevExpress.XtraGrid.Views.Grid;
void OnCustomScrollAnnotation(object sender, GridCustomScrollAnnotationsEventArgs e) {
e.Annotations = new List<GridScrollAnnotationInfo>();
GridScrollAnnotationInfo info = new GridScrollAnnotationInfo() { RowHandle = 74, Color = Color.Red };
e.Annotations.Add(info);
}
Imports using DevExpress.XtraGrid.Views.Grid
Private Sub OnCustomScrollAnnotation(ByVal sender As Object, ByVal e As GridCustomScrollAnnotationsEventArgs)
e.Annotations = New List(Of GridScrollAnnotationInfo)()
Dim info As New GridScrollAnnotationInfo() With {.RowHandle = 74, .Color = Color.Red}
e.Annotations.Add(info)
End Sub
You can also use the e.SetAnnotations method to set annotations for a row array.
void OnCustomScrollAnnotation(object sender, GridCustomScrollAnnotationsEventArgs e) {
int[] rowHandles = new int[] { 5, 17, 74 };
e.SetAnnotations(Color.Red, rowHandles);
}
Private Sub OnCustomScrollAnnotation(ByVal sender As Object, ByVal e As GridCustomScrollAnnotationsEventArgs) Handles gridView.CustomScrollAnnotation
Dim rowHandles() As Integer = {5, 17, 74}
e.SetAnnotations(Color.Red, rowHandles)
End Sub
Use the RefreshScrollAnnotations method to force the grid control to update/redraw scrollbar annotations.
See Also