ToolStripRenderer.RenderToolStripContentPanelBackground 事件

定義

繪製 ToolStripContentPanel 的背景。

public:
 event System::Windows::Forms::ToolStripContentPanelRenderEventHandler ^ RenderToolStripContentPanelBackground;
public event System.Windows.Forms.ToolStripContentPanelRenderEventHandler RenderToolStripContentPanelBackground;
member this.RenderToolStripContentPanelBackground : System.Windows.Forms.ToolStripContentPanelRenderEventHandler 
Public Custom Event RenderToolStripContentPanelBackground As ToolStripContentPanelRenderEventHandler 

事件類型

範例

下列程式碼範例示範如何使用這個成員。 在此範例中,事件處理常式會報告事件的發生次數 RenderToolStripContentPanelBackground 。 此報告可協助您瞭解事件發生的時間,並可協助您進行偵錯。

若要執行範例程式碼,請將它貼入包含繼承自 ToolStripRenderer 之型別實例的專案,例如 ToolStripSystemRendererToolStripProfessionalRenderer 。 然後命名 實例 ToolStripRenderer1 ,並確定事件處理常式與 事件相關聯 RenderToolStripContentPanelBackground

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

備註

如需處理事件的詳細資訊,請參閱 處理和引發事件

適用於