ToolStripRenderer.OnRenderToolStripBorder(ToolStripRenderEventArgs) ToolStripRenderer.OnRenderToolStripBorder(ToolStripRenderEventArgs) ToolStripRenderer.OnRenderToolStripBorder(ToolStripRenderEventArgs) ToolStripRenderer.OnRenderToolStripBorder(ToolStripRenderEventArgs) Method

定义

引发 RenderToolStripBorder 事件。Raises the RenderToolStripBorder event.

protected:
 virtual void OnRenderToolStripBorder(System::Windows::Forms::ToolStripRenderEventArgs ^ e);
protected virtual void OnRenderToolStripBorder (System.Windows.Forms.ToolStripRenderEventArgs e);
abstract member OnRenderToolStripBorder : System.Windows.Forms.ToolStripRenderEventArgs -> unit
override this.OnRenderToolStripBorder : System.Windows.Forms.ToolStripRenderEventArgs -> unit
Protected Overridable Sub OnRenderToolStripBorder (e As ToolStripRenderEventArgs)

参数

示例

下面的代码示例演示如何重写 OnRenderToolStripBorder 方法,以便在 @no__t 1 控件周围绘制自定义边框。The following code example demonstrates how to override the OnRenderToolStripBorder method to draw a custom border around a ToolStrip control. 此代码示例是为 ToolStripRenderer 类提供的更大示例的一部分。This code example is part of a larger example provided for the ToolStripRenderer class.

// This method draws a border around the GridStrip control.
protected override void OnRenderToolStripBorder(
    ToolStripRenderEventArgs e)
{
    base.OnRenderToolStripBorder(e);

    ControlPaint.DrawFocusRectangle(
        e.Graphics,
        e.AffectedBounds,
        SystemColors.ControlDarkDark,
        SystemColors.ControlDarkDark);
}
' This method draws a border around the GridStrip control.
Protected Overrides Sub OnRenderToolStripBorder(e As ToolStripRenderEventArgs)
   MyBase.OnRenderToolStripBorder(e)
   
   ControlPaint.DrawFocusRectangle(e.Graphics, e.AffectedBounds, SystemColors.ControlDarkDark, SystemColors.ControlDarkDark)
End Sub 

注解

引发事件时,将通过委托调用事件处理程序。Raising an event invokes the event handler through a delegate. 有关详细信息,请参阅处理和引发事件For more information, see Handling and Raising Events.

OnRenderToolStripBorder 方法还允许派生类对事件进行处理而不必附加委托。The OnRenderToolStripBorder method also allows derived classes to handle the event without attaching a delegate. 这是在派生类中处理事件的首选技术。This is the preferred technique for handling the event in a derived class.

继承者说明

在派生类中重写 OnRenderToolStripBorder(ToolStripRenderEventArgs) 时,一定要调用基类的 OnRenderToolStripBorder(ToolStripRenderEventArgs) 方法,以便已注册的委托对事件进行接收。When overriding OnRenderToolStripBorder(ToolStripRenderEventArgs) in a derived class, be sure to call the base class's OnRenderToolStripBorder(ToolStripRenderEventArgs) method so that registered delegates receive the event.

适用于

另请参阅