ScrollEventHandler デリゲート
.NET Framework 3.0
DataGridView、ScrollBar、TrackBar、または DataGrid の Scroll イベントを処理するメソッドを表します。
名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
ScrollEventArgs デリゲートを作成する場合は、イベントを処理するメソッドを識別してください。イベントをイベント ハンドラに関連付けるには、デリゲートのインスタンスをイベントに追加します。デリゲートを削除しない限り、そのイベントが発生すると常にイベント ハンドラが呼び出されます。イベント ハンドラ デリゲートの詳細については、「イベントとデリゲート」を参照してください。
この型の使用方法を次のコード例に示します。
private void AddMyScrollEventHandlers() { // Create and initialize a VScrollBar. VScrollBar vScrollBar1 = new VScrollBar(); // Add event handlers for the OnScroll and OnValueChanged events. vScrollBar1.Scroll += new ScrollEventHandler( this.vScrollBar1_Scroll); vScrollBar1.ValueChanged += new EventHandler( this.vScrollBar1_ValueChanged); } // Create the ValueChanged event handler. private void vScrollBar1_ValueChanged(Object sender, EventArgs e) { // Display the new value in the label. label1.Text = "vScrollBar Value:(OnValueChanged Event) " + vScrollBar1.Value.ToString(); } // Create the Scroll event handler. private void vScrollBar1_Scroll(Object sender, ScrollEventArgs e) { // Display the new value in the label. label1.Text = "VScrollBar Value:(OnScroll Event) " + e.NewValue.ToString(); } private void button1_Click(Object sender, EventArgs e) { // Add 40 to the Value property if it will not exceed the Maximum value. if (vScrollBar1.Value + 40 < vScrollBar1.Maximum) { vScrollBar1.Value = vScrollBar1.Value + 40; } }
private void AddMyScrollEventHandlers()
{
// Create and initialize a VScrollBar.
VScrollBar vScrollBar1 = new VScrollBar();
// Add event handlers for the OnScroll and OnValueChanged events.
vScrollBar1.add_Scroll(
new ScrollEventHandler(this.vScrollBar1_Scroll));
vScrollBar1.add_ValueChanged(
new EventHandler(this.vScrollBar1_ValueChanged));
} //AddMyScrollEventHandlers
// Create the ValueChanged event handler.
private void vScrollBar1_ValueChanged(Object sender, EventArgs e)
{
// Display the new value in the label.
label1.set_Text("vScrollBar Value:(OnValueChanged Event) "
+ vScrollBar1.get_Value());
} //vScrollBar1_ValueChanged
// Create the Scroll event handler.
private void vScrollBar1_Scroll(Object sender, ScrollEventArgs e)
{
// Display the new value in the label.
label1.set_Text(
"VScrollBar Value:(OnScroll Event) " + e.get_NewValue());
} //vScrollBar1_Scroll
private void button1_Click(Object sender, EventArgs e)
{
// Add 40 to the Value property if it will not exceed the Maximum
// value.
if (vScrollBar1.get_Value() + 40 < vScrollBar1.get_Maximum()) {
vScrollBar1.set_Value(vScrollBar1.get_Value() + 40);
}
} //button1_Click
Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition
Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。