LEADTOOLS Windows Forms (Leadtools.WinForms assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.30
Invalidate Method
See Also 
Leadtools.WinForms Namespace > RasterImageListItem Class : Invalidate Method



Redraws the item and causes a paint message to be sent to the RasterImageList control that owns this item.

Syntax

Visual Basic (Declaration) 
Public Sub Invalidate() 
Visual Basic (Usage)Copy Code
Dim instance As RasterImageListItem
 
instance.Invalidate()
C# 
public void Invalidate()
C++/CLI 
public:
void Invalidate(); 

Example

This example shows how to manually select an item in a RasterImageListItem while updating only the affected area.

Visual BasicCopy Code
''' 
Private Sub SelectImageListItem(ByVal imageList As RasterImageList, ByVal itemIndex As Integer)
   ' Loop through all the items in the list
   Dim i As Integer = 0
   Do While i < imageList.Items.Count
      Dim item As RasterImageListItem = imageList.Items(i)
      ' If this is not out item and is selected, de-select it
      If i <> itemIndex AndAlso item.Selected Then
         item.Selected = False

         ' re-paint only this item
         item.Invalidate()
      End If

      ' If this is our item and is not selected already, select it
      If i = itemIndex AndAlso (Not item.Selected) Then
         item.Selected = True

         ' re-paint only this item
         item.Invalidate()
      End If
      i += 1
   Loop
End Sub
C#Copy Code
/// 
private void SelectImageListItem(RasterImageList imageList, int itemIndex)
{
   // Loop through all the items in the list
   for (int i = 0; i < imageList.Items.Count; i++)
   {
      RasterImageListItem item = imageList.Items[i];
      // If this is not out item and is selected, de-select it
      if (i != itemIndex && item.Selected)
      {
         item.Selected = false;

         // re-paint only this item
         item.Invalidate();
      }

      // If this is our item and is not selected already, select it
      if (i == itemIndex && !item.Selected)
      {
         item.Selected = true;

         // re-paint only this item
         item.Invalidate();
      }
   }
}

Remarks

You can call Invalidate after you make changes to a certain RasterImageListItem that belongs to a RasterImageList control. Calling Invalidate on the item causes only the portion of the control covered with the item to be invalidated as apposed to invalidating the surface of the entire control.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also