Leadtools.WinForms Namespace > RasterImageList Class : GetItemRectangle Method |
public Rectangle GetItemRectangle( RasterImageListItem item )
'Declaration Public Function GetItemRectangle( _ ByVal item As RasterImageListItem _ ) As Rectangle
'Usage Dim instance As RasterImageList Dim item As RasterImageListItem Dim value As Rectangle value = instance.GetItemRectangle(item)
public Rectangle GetItemRectangle( RasterImageListItem item )
function Leadtools.WinForms.RasterImageList.GetItemRectangle( item )
public: Rectangle GetItemRectangle( RasterImageListItem^ item )
The bounding rectangle returned by this method represents the entire item.
The bounding rectangle that this method returns could contain a negative position or could be outside the client rectangle of the control. The exact position of the item depends on the current size of the control as well as the current scroll position.
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
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); } } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2