Share via


ColumnReorderedEventArgs.NewDisplayIndex Özellik

Tanım

öğesinin yeni görüntü konumunu ColumnHeaderalır.

public:
 property int NewDisplayIndex { int get(); };
public int NewDisplayIndex { get; }
member this.NewDisplayIndex : int
Public ReadOnly Property NewDisplayIndex As Integer

Özellik Değeri

öğesinin ColumnHeaderyeni görüntüleme konumu.

Örnekler

Aşağıdaki kod örneğinde bu üyenin kullanımı gösterilmektedir. Örnekte, olay işleyicisi olayın oluşumunu ListView.ColumnReordered raporlar. Bu rapor, olayın ne zaman gerçekleştiğini öğrenmenize yardımcı olur ve hata ayıklamada size yardımcı olabilir. Birden çok olayı veya sık gerçekleşen olayları raporlamak için, iletisini ile Console.WriteLine değiştirmeyi MessageBox.Show veya iletiyi çok satırlı TextBoxbir iletiye eklemeyi göz önünde bulundurun.

Örnek kodu çalıştırmak için, adlı ListView1bir tür ListView örneği içeren bir projeye yapıştırın. Ardından olay işleyicisinin olayla ilişkilendirildiğinden ListView.ColumnReordered emin olun.

private void ListView1_ColumnReordered(Object sender, ColumnReorderedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "OldDisplayIndex", e.OldDisplayIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "NewDisplayIndex", e.NewDisplayIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Header", e.Header );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "ColumnReordered Event" );
}
Private Sub ListView1_ColumnReordered(sender as Object, e as ColumnReorderedEventArgs) _ 
     Handles ListView1.ColumnReordered

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "OldDisplayIndex", e.OldDisplayIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "NewDisplayIndex", e.NewDisplayIndex)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Header", e.Header)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Cancel", e.Cancel)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"ColumnReordered Event")

End Sub

Açıklamalar

özelliği ColumnReorderedtrueolarak ayarlanarak Cancel olay iptal edilebilir. Ancak, olay iptal edilirse değeri NewDisplayIndex değişmez OldDisplayIndex .

Şunlara uygulanır