Manina.Windows.Forms.ImageListViewLayoutManager.GetIconBounds C# (CSharp) Method

GetIconBounds() public method

Returns the item icon bounds. This method assumes an icon size of 16x16
public GetIconBounds ( int itemIndex ) : Rectangle
itemIndex int
return System.Drawing.Rectangle
        public Rectangle GetIconBounds(int itemIndex)
        {
            Rectangle bounds = GetWidgetBounds(GetItemBounds(itemIndex), new Size(16, 16),
                mImageListView.IconPadding, mImageListView.IconAlignment);

            // If the checkbox and the icon have the same alignment,
            // or in details view move the icon horizontally away from the checkbox
            if (mImageListView.View == View.Details && mImageListView.ShowCheckBoxes && mImageListView.ShowFileIcons)
                bounds.X += 16 + 2;
            else if (mImageListView.CheckBoxAlignment == mImageListView.IconAlignment &&
                mImageListView.ShowCheckBoxes && mImageListView.ShowFileIcons)
            {
                ContentAlignment alignment = mImageListView.CheckBoxAlignment;
                if (alignment == ContentAlignment.BottomLeft || alignment == ContentAlignment.MiddleLeft || alignment == ContentAlignment.TopLeft)
                    bounds.X += 16 + mImageListView.IconPadding.Width;
                else if (alignment == ContentAlignment.BottomCenter || alignment == ContentAlignment.MiddleCenter || alignment == ContentAlignment.TopCenter)
                    bounds.X += 8 + mImageListView.IconPadding.Width / 2;
            }

            return bounds;
        }