Retrieves the bounding rectangle for a specific item within the
RasterImageList control.
Syntax
Example
This example will highlight the position of all visible items a RasterImageList control.
Visual Basic | Copy Code |
---|
Public Sub RasterImageList_GetItemRectangle(ByVal imageList As RasterImageList)
' Loop through all items
For Each item As RasterImageListItem In imageList.Items
' Get the item bounding rectangle
Dim rc As Rectangle = imageList.GetItemRectangle(item)
' If this rectangle is visible, highlight it
If imageList.ClientRectangle.IntersectsWith(rc) Then
' Convert the rectangle to screen coordinates
rc = imageList.RectangleToScreen(rc)
ControlPaint.DrawReversibleFrame(rc, Color.Transparent, FrameStyle.Thick)
End If
Next item
End Sub |
C# | Copy Code |
---|
public void RasterImageList_GetItemRectangle(RasterImageList imageList)
{
// Loop through all items
foreach(RasterImageListItem item in imageList.Items)
{
// Get the item bounding rectangle
Rectangle rc = imageList.GetItemRectangle(item);
// If this rectangle is visible, highlight it
if(imageList.ClientRectangle.IntersectsWith(rc))
{
// Convert the rectangle to screen coordinates
rc = imageList.RectangleToScreen(rc);
ControlPaint.DrawReversibleFrame(rc, Color.Transparent, FrameStyle.Thick);
}
}
} |
Remarks
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