ToolStripItemTextRenderEventArgs.TextFormat 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 mengatur informasi tampilan dan tata letak teks yang digambar pada ToolStripItem.
public:
property System::Windows::Forms::TextFormatFlags TextFormat { System::Windows::Forms::TextFormatFlags get(); void set(System::Windows::Forms::TextFormatFlags value); };
public System.Windows.Forms.TextFormatFlags TextFormat { get; set; }
member this.TextFormat : System.Windows.Forms.TextFormatFlags with get, set
Public Property TextFormat As TextFormatFlags
Nilai Properti
Kombinasi bitwise dari TextFormatFlags nilai yang menentukan informasi tampilan dan tata letak teks yang digambar.
Contoh
Contoh kode berikut menunjukkan penggunaan anggota ini. Dalam contoh, penanganan aktivitas melaporkan terjadinya ToolStripRenderer.RenderItemText 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 yang mewarisi dari ToolStripRenderer, seperti ToolStripSystemRenderer atau ToolStripProfessionalRenderer. Kemudian beri nama instans ToolStripRenderer1 dan pastikan bahwa penanganan aktivitas dikaitkan dengan ToolStripRenderer.RenderItemText peristiwa.
private void ToolStripRenderer1_RenderItemText(Object sender, ToolStripItemTextRenderEventArgs e) {
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Text", e.Text );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "TextColor", e.TextColor );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "TextFont", e.TextFont );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "TextRectangle", e.TextRectangle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "TextFormat", e.TextFormat );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "TextDirection", e.TextDirection );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Item", e.Item );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ToolStrip", e.ToolStrip );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RenderItemText Event" );
}
Private Sub ToolStripRenderer1_RenderItemText(sender as Object, e as ToolStripItemTextRenderEventArgs) _
Handles ToolStripRenderer1.RenderItemText
Dim messageBoxVB as New System.Text.StringBuilder()
messageBoxVB.AppendFormat("{0} = {1}", "Text", e.Text)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "TextColor", e.TextColor)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "TextFont", e.TextFont)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "TextRectangle", e.TextRectangle)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "TextFormat", e.TextFormat)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "TextDirection", e.TextDirection)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Graphics", e.Graphics)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Item", e.Item)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ToolStrip", e.ToolStrip)
messageBoxVB.AppendLine()
MessageBox.Show(messageBoxVB.ToString(),"RenderItemText Event")
End Sub