Bagikan melalui


ToolStripContentPanelRenderEventArgs.Graphics Properti

Definisi

Mendapatkan objek yang akan digunakan untuk menggambar.

public:
 property System::Drawing::Graphics ^ Graphics { System::Drawing::Graphics ^ get(); };
public System.Drawing.Graphics Graphics { get; }
member this.Graphics : System.Drawing.Graphics
Public ReadOnly Property Graphics As Graphics

Nilai Properti

yang Graphics digunakan untuk menggambar.

Contoh

Contoh kode berikut menunjukkan penggunaan anggota ini. Dalam contoh, penanganan aktivitas melaporkan terjadinya ToolStripRenderer.RenderToolStripContentPanelBackground 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.RenderToolStripContentPanelBackground peristiwa.

private void ToolStripRenderer1_RenderToolStripContentPanelBackground(Object sender, ToolStripContentPanelRenderEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Handled", e.Handled );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ToolStripContentPanel", e.ToolStripContentPanel );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "RenderToolStripContentPanelBackground Event" );
}
Private Sub ToolStripRenderer1_RenderToolStripContentPanelBackground(sender as Object, e as ToolStripContentPanelRenderEventArgs) _ 
     Handles ToolStripRenderer1.RenderToolStripContentPanelBackground

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "Graphics", e.Graphics)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Handled", e.Handled)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ToolStripContentPanel", e.ToolStripContentPanel)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"RenderToolStripContentPanelBackground Event")

End Sub

Berlaku untuk