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)

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

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

Parameters

r
Rectangle

A Rectangle that represents the region to invalidate.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

Invalidate()

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

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

public void 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();
}

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9