ToolStripItem.Invalidate ToolStripItem.Invalidate ToolStripItem.Invalidate ToolStripItem.Invalidate Method

定义

使 ToolStripItem 的部分或整个图面无效并导致重绘该部分或整个图面。Invalidates some or all of the surface of the ToolStripItem and causes it to be redrawn.

重载

Invalidate(Rectangle) Invalidate(Rectangle) Invalidate(Rectangle) Invalidate(Rectangle)

通过将 ToolStripItem 的指定区域添加到 ToolStripItem 的更新区域(即下次执行绘制操作时将重新绘制的区域)使该指定区域无效,并导致向 ToolStripItem 发送绘制消息。Invalidates 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() Invalidate() Invalidate() Invalidate()

使 ToolStripItem 的整个图面无效并导致重绘该图面。Invalidates the entire surface of the ToolStripItem and causes it to be redrawn.

Invalidate(Rectangle) Invalidate(Rectangle) Invalidate(Rectangle) Invalidate(Rectangle)

通过将 ToolStripItem 的指定区域添加到 ToolStripItem 的更新区域(即下次执行绘制操作时将重新绘制的区域)使该指定区域无效,并导致向 ToolStripItem 发送绘制消息。Invalidates 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 Rectangle Rectangle

一个 Rectangle,表示要使之无效的区域。A Rectangle that represents the region to invalidate.

Invalidate() Invalidate() 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

适用于