ToolStripItem.Invalidate 方法

定义

使部分或全部图面 ToolStripItem 失效,并导致其重新绘制。

重载

名称 说明
Invalidate(Rectangle)

通过将指定区域添加到更新区域的更新区域ToolStripItem(即将在下一个绘制操作中重新绘制的区域)来使指定区域ToolStripItem失效,并导致将油漆消息发送到该ToolStripItem区域。

Invalidate()

使整个图面 ToolStripItem 失效,并导致其重新绘制。

Invalidate(Rectangle)

Source:
ToolStripItem.cs
Source:
ToolStripItem.cs
Source:
ToolStripItem.cs
Source:
ToolStripItem.cs
Source:
ToolStripItem.cs

通过将指定区域添加到更新区域的更新区域ToolStripItem(即将在下一个绘制操作中重新绘制的区域)来使指定区域ToolStripItem失效,并导致将油漆消息发送到该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 表示要失效的区域。

适用于

Invalidate()

Source:
ToolStripItem.cs
Source:
ToolStripItem.cs
Source:
ToolStripItem.cs
Source:
ToolStripItem.cs
Source:
ToolStripItem.cs

使整个图面 ToolStripItem 失效,并导致其重新绘制。

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

示例

下面的代码示例演示如何使用 Invalidate 该方法进行自定义呈现。 该代码示例是 ToolStripItem 类中的一个较大示例的一部分。

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

适用于