ToolStripItem.Invalidate 方法

定義

ToolStripItem 的部分或整個介面失效,並重新繪製它。Invalidates some or all of the surface of the ToolStripItem and causes it to be redrawn.

多載

Invalidate(Rectangle)

藉由將 ToolStripItem 的指定區域加入 ToolStripItem 的更新區域的方式使指定區域失效 (更新區域會在下一次繪製作業中重新繪製),並使繪製訊息傳送至 ToolStripItemInvalidates the specified region of the ToolStripItem by adding it to the update region of the ToolStripItem, which is the area that will be repainted at the next paint operation, and causes a paint message to be sent to the ToolStripItem.

Invalidate()

ToolStripItem 的整個介面失效,並重新繪製它。Invalidates the entire surface of the ToolStripItem and causes it to be redrawn.

Invalidate(Rectangle)

藉由將 ToolStripItem 的指定區域加入 ToolStripItem 的更新區域的方式使指定區域失效 (更新區域會在下一次繪製作業中重新繪製),並使繪製訊息傳送至 ToolStripItemInvalidates the specified region of the ToolStripItem by adding it to the update region of the ToolStripItem, which is the area that will be repainted at the next paint operation, and causes a paint message to be sent to the ToolStripItem.

public:
 void Invalidate(System::Drawing::Rectangle r);
public void Invalidate (System.Drawing.Rectangle r);
member this.Invalidate : System.Drawing.Rectangle -> unit
Public Sub Invalidate (r As Rectangle)

參數

r
Rectangle

Rectangle,表示要使其失效的區域。A Rectangle that represents the region to invalidate.

Invalidate()

ToolStripItem 的整個介面失效,並重新繪製它。Invalidates the entire surface of the ToolStripItem and causes it to be redrawn.

public:
 void Invalidate();
public void Invalidate ();
member this.Invalidate : unit -> unit
Public Sub Invalidate ()

範例

下列程式碼範例示範如何使用 Invalidate 方法進行自訂轉譯。The following code example demonstrates how to use the Invalidate method for custom rendering. 這個程式碼範例是針對 ToolStripItem 類別所提供的較大範例的一部分。This code example is part of a larger example provided for the ToolStripItem class.

// This method defines the behavior of the MouseEnter event.
// It sets the state of the rolloverValue field to true and
// tells the control to repaint.
protected override void OnMouseEnter(EventArgs e)
{
    base.OnMouseEnter(e);

    this.rolloverValue = true;

    this.Invalidate();
}
' This method defines the behavior of the MouseEnter event.
' It sets the state of the rolloverValue field to true and
' tells the control to repaint.
Protected Overrides Sub OnMouseEnter(e As EventArgs)
   MyBase.OnMouseEnter(e)
   
   Me.rolloverValue = True
   
   Me.Invalidate()
 End Sub

適用於