Edit

Share via


ToolStripItem.Invalidate Method

Definition

Invalidates some or all of the surface of the ToolStripItem and causes it to be redrawn.

Overloads

Invalidate(Rectangle)

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

Invalidates the entire surface of the ToolStripItem and causes it to be redrawn.

Invalidate(Rectangle)

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)

Parameters

r
Rectangle

A Rectangle that represents the region to invalidate.

Applies to

Invalidate()

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

Examples

The following code example demonstrates how to use the Invalidate method for custom rendering. 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

Applies to