ScrollEventArgs.ScrollOrientation プロパティ

定義

Scroll イベントを発生させたスクロール バーの方向を取得します。

public:
 property System::Windows::Forms::ScrollOrientation ScrollOrientation { System::Windows::Forms::ScrollOrientation get(); };
public System.Windows.Forms.ScrollOrientation ScrollOrientation { get; }
member this.ScrollOrientation : System.Windows.Forms.ScrollOrientation
Public ReadOnly Property ScrollOrientation As ScrollOrientation

プロパティ値

ScrollOrientation 値のいずれか 1 つ。

次のコード例では、このメンバーの使用方法を示します。 この例では、イベント ハンドラーがイベントの ScrollableControl.Scroll 発生を報告します。 このレポートは、イベントが発生したタイミングを知るのに役立ち、デバッグに役立ちます。 複数のイベントまたは頻繁に発生するイベントを報告するには、 を Console.WriteLine に置き換えるかMessageBox.Show、複数行TextBoxにメッセージを追加することを検討してください。

コード例を実行するには、 や ContainerControlなどPanel、 からScrollableControl継承する型のインスタンスを含むプロジェクトに貼り付けます。 次に、インスタンス ScrollableControl1 に名前を付け、イベント ハンドラーがイベントに ScrollableControl.Scroll 関連付けられていることを確認します。

private void ScrollableControl1_Scroll(Object sender, ScrollEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "ScrollOrientation", e.ScrollOrientation );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Type", e.Type );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "NewValue", e.NewValue );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "OldValue", e.OldValue );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Scroll Event" );
}
Private Sub ScrollableControl1_Scroll(sender as Object, e as ScrollEventArgs) _ 
     Handles ScrollableControl1.Scroll

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "ScrollOrientation", e.ScrollOrientation)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Type", e.Type)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "NewValue", e.NewValue)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "OldValue", e.OldValue)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"Scroll Event")

End Sub

注釈

通常、 プロパティを ScrollOrientation 使用して、イベントを発生させたスクロール バーの向き ( Scroll イベントなど) を ScrollableControl.Scroll 決定します。

適用対象