ToolStripContentPanelRenderEventArgs.ToolStripContentPanel 属性

定义

获取受单击影响的 ToolStripContentPanel

public:
 property System::Windows::Forms::ToolStripContentPanel ^ ToolStripContentPanel { System::Windows::Forms::ToolStripContentPanel ^ get(); };
public System.Windows.Forms.ToolStripContentPanel ToolStripContentPanel { get; }
member this.ToolStripContentPanel : System.Windows.Forms.ToolStripContentPanel
Public ReadOnly Property ToolStripContentPanel As ToolStripContentPanel

属性值

受单击影响的 ToolStripContentPanel

示例

下面的代码示例演示了此成员的用法。 在此示例中,事件处理程序报告事件的发生情况 ToolStripRenderer.RenderToolStripContentPanelBackground 。 此报告可帮助你了解事件发生的时间,并可以帮助你进行调试。

若要运行示例代码,请将其粘贴到包含继承自 ToolStripRenderer的类型的实例(如 ToolStripSystemRendererToolStripProfessionalRenderer)的项目中。 然后命名实例 ToolStripRenderer1 并确保事件处理程序与事件 ToolStripRenderer.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

适用于