DrawListViewColumnHeaderEventArgs.DrawDefault Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau menetapkan nilai yang menunjukkan apakah header kolom harus digambar oleh sistem operasi alih-alih digambar pemilik.
public:
property bool DrawDefault { bool get(); void set(bool value); };
public bool DrawDefault { get; set; }
member this.DrawDefault : bool with get, set
Public Property DrawDefault As Boolean
Nilai Properti
true
jika header harus digambar oleh sistem operasi; jika tidak, false
. Default adalah false
.
Contoh
Contoh kode berikut menunjukkan penggunaan anggota ini. Dalam contoh, penanganan aktivitas melaporkan kemunculan ListView.DrawColumnHeader peristiwa. Laporan ini membantu Anda mempelajari kapan peristiwa terjadi dan dapat membantu Anda dalam penelusuran kesalahan.
Untuk menjalankan kode contoh, tempelkan ke dalam proyek yang berisi instans jenis ListView bernama ListView1
. Kemudian pastikan bahwa penanganan aktivitas dikaitkan dengan peristiwa.ListView.DrawColumnHeader
private void ListView1_DrawColumnHeader(Object sender, DrawListViewColumnHeaderEventArgs e) {
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "DrawDefault", e.DrawDefault );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Bounds", e.Bounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Header", e.Header );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "State", e.State );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ForeColor", e.ForeColor );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "BackColor", e.BackColor );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Font", e.Font );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "DrawColumnHeader Event" );
}
Private Sub ListView1_DrawColumnHeader(sender as Object, e as DrawListViewColumnHeaderEventArgs) _
Handles ListView1.DrawColumnHeader
Dim messageBoxVB as New System.Text.StringBuilder()
messageBoxVB.AppendFormat("{0} = {1}", "DrawDefault", e.DrawDefault)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Graphics", e.Graphics)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Bounds", e.Bounds)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Header", e.Header)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "State", e.State)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ForeColor", e.ForeColor)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "BackColor", e.BackColor)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Font", e.Font)
messageBoxVB.AppendLine()
MessageBox.Show(messageBoxVB.ToString(),"DrawColumnHeader Event")
End Sub
Keterangan
Gunakan properti ini saat menangani ListView.DrawColumnHeader peristiwa untuk header yang tidak ingin Anda kustomisasi. Jika Anda mengatur properti ini ke true
, header akan digambar seperti biasa.