Share via


ScrollEventArgs.ScrollOrientation Properti

Definisi

Mendapatkan orientasi bilah gulir yang menaikkan Scroll acara.

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

Nilai Properti

Salah ScrollOrientation satu nilai.

Contoh

Contoh kode berikut menunjukkan penggunaan anggota ini. Dalam contoh, penanganan aktivitas melaporkan terjadinya ScrollableControl.Scroll peristiwa. Laporan ini membantu Anda mempelajari kapan peristiwa terjadi dan dapat membantu Anda dalam penelusuran kesalahan. Untuk melaporkan beberapa peristiwa atau pada peristiwa yang sering terjadi, pertimbangkan untuk mengganti MessageBox.Show dengan Console.WriteLine atau menambahkan pesan ke multibaris TextBox.

Untuk menjalankan kode contoh, tempelkan ke dalam proyek yang berisi instans jenis yang mewarisi dari ScrollableControl, seperti Panel atau ContainerControl. Kemudian beri nama instans ScrollableControl1 dan pastikan bahwa penanganan aktivitas dikaitkan dengan ScrollableControl.Scroll peristiwa.

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

Keterangan

Anda biasanya akan menggunakan ScrollOrientation properti untuk menentukan orientasi bilah gulir yang menaikkan Scroll peristiwa, seperti dengan ScrollableControl.Scroll peristiwa.

Berlaku untuk