ToolStripRenderEventArgs.AffectedBounds 属性

定义

获取表示待绘制区域的边界的 Rectangle

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

属性值

Rectangle

一个 Rectangle,表示待绘制区域的边界。

示例

下面的代码示例演示如何重写方法 OnRenderToolStripBorder 以围绕控件绘制自定义边框 ToolStrip 。 此代码示例是为类提供的大型示例的 ToolStripRenderer 一部分。

// 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

适用于

另请参阅