SidebarLibrary.WinControls.OutlookBar.GetItemRect C# (CSharp) Method

GetItemRect() public method

public GetItemRect ( Graphics g, OutlookBarBand band, int index, Rectangle targetRect ) : Rectangle
g System.Drawing.Graphics
band OutlookBarBand
index int
targetRect System.Drawing.Rectangle
return System.Drawing.Rectangle
		public Rectangle GetItemRect(Graphics g, OutlookBarBand band, int index, Rectangle targetRect)
		{
			Rectangle rc = GetViewPortRect();
			if ( targetRect != Rectangle.Empty ) rc = targetRect;
			Size itemSize = new Size(0,0);
			int top = rc.Top;
			int y = 0;
			for ( int i = 0; i < index; i++ )
			{
				itemSize = GetItemSize(g, band, i, ItemSizeType.All);
				top += itemSize.Height;
				if ( band.IconView == IconView.Small )
					top += Y_SMALLICON_SPACING;
				else
					top += Y_LARGEICON_SPACING;
				if ( i == (firstItem - 1) )
				{
					// Subtract the hidden items height
					y = top - rc.Top;
				}
			}

			itemSize = GetItemSize(g, band, index, ItemSizeType.All);
			int margin = SMALL_TOP_MARGIN;
			if ( band.IconView == IconView.Large )
				margin = LARGE_TOP_MARGIN;

			// Work with Windows Rect is easier to change settings
			RECT rcItem = new RECT();
			rcItem.left = rc.Left;
			rcItem.top = top;
			rcItem.right = rc.Left + itemSize.Width;
			rcItem.bottom = top + itemSize.Height;

			// Adjust rectangle
			rcItem.top -= y;
			rcItem.bottom -= y;
			rcItem.top += margin;
			rcItem.bottom += margin;

			if ( band.IconView == IconView.Small )
			{
				rcItem.left  = rc.Left + LEFT_MARGIN;
				rcItem.right = rc.Right;
			}

			// Construct final rectangle
			Rectangle actualRect = new Rectangle(rcItem.left,
				rcItem.top, rcItem.right - rcItem.left, rcItem.bottom - rcItem.top);

			return actualRect;
		}
		public void ProcessOnMouseDown(MouseEventArgs e)