共用方式為


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

適用於

另請參閱