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() |
C# | |
---|
public void Invalidate() |
Managed Extensions for 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
effected area.
Visual Basic | Copy Code |
---|
Private Sub SelectImageListItem(ByVal imageList As RasterImageList, ByVal itemIndex As Integer)
Dim i As Integer = 0
Do While i < imageList.Items.Count
Dim item As RasterImageListItem = imageList.Items(i)
If i <> itemIndex AndAlso item.Selected Then
item.Selected = False
item.Invalidate()
End If
If i = itemIndex AndAlso (Not item.Selected) Then
item.Selected = True
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
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also