'宣言 Public Event ScrollBarAnnotationsUpdated As System.EventHandler(Of ScrollBarAnnotationsUpdatedArgs)
public event System.EventHandler<ScrollBarAnnotationsUpdatedArgs> ScrollBarAnnotationsUpdated
イベント データ
イベント ハンドラが、このイベントに関連するデータを含む、ScrollBarAnnotationsUpdatedArgs 型の引数を受け取りました。次の ScrollBarAnnotationsUpdatedArgs プロパティには、このイベントの固有の情報が記載されます。
| プロパティ | 解説 |
|---|---|
Annotations | 注釈コレクションへの参照を取得します。 |
使用例
イベント引数 ScrollBarAnnotationsUpdatedArgs で、すべてのグリッド注釈のリストにカスタム注釈を追加できます。
public enum CustomAnnotationType { Custom1, Custom2 } public class CustomAnnotation : ScrollBarAnnotation { public CustomAnnotationType Type { get; } public CustomAnnotation(CustomAnnotationType type, string text, double position, Color? color = null, HorizontalAlignment alignment = HorizontalAlignment.Center, int width = 100, int height = 2) : base(text, position, color, alignment, width, height) { Type = type; } } private void C1FlexGrid1_ScrollBarAnnotationsUpdated(object sender, ScrollBarAnnotationsUpdatedArgs e) { ScrollBarAnnotation customAnnotation = e.Annotations.FirstOrDefault(x => x is CustomAnnotation ca && ca.Type == CustomAnnotationType.Custom1); var text = $"Custom annotation. Time: {DateTime.Now.ToLongTimeString()}"; if (customAnnotation == null) { e.Annotations.Add(new CustomAnnotation(CustomAnnotationType.Custom1, text, 11, Color.Green, width: 70, height: 8)); e.Annotations.Add(new CustomAnnotation(CustomAnnotationType.Custom2, text, 55, Color.YellowGreen, width: 70, height: -1)); } else { customAnnotation.Text = text; } }
参照