![](https://i0.wp.com/www.gesource.jp/weblog/wp-content/uploads/2018/11/NSScrollViewScrollEventSample.gif?fit=572%2C365&ssl=1)
NSScrollViewにはスクロールのイベントはありません。
NSScrollViewのスクロールのイベントを取得するには、NSScrollViewのContentViewの”NSViewBoundsDidChangeNotification”の通知を受け取ります。
NSNotificationCenter.DefaultCenter.AddObserver(
new NSString("NSViewBoundsDidChangeNotification"),
(NSNotification notification) =>
{
var contentView = notification.Object as NSClipView;
var location = contentView.Bounds.Location;
Label.StringValue = new NSString($"location X:{location.X} Y:{location.Y}");
},
ScrollView.ContentView);
サンプルプログラム
Githubからサンプルプログラムをダウンロードできます。