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

GetHeaderRect() private method

private GetHeaderRect ( int index ) : Rectangle
index int
return System.Drawing.Rectangle
		Rectangle GetHeaderRect(int index)
		{
			// Make sure we are within bounds
			Debug.Assert((index >= 0 && index <= bands.Count-1), "Invalid Header Index");
			Rectangle rect = GetWorkRect();

			int top = rect.Top;
			int bottom = rect.Bottom;
			int max = bands.Count;

			if ( index > currentBandIndex )
			{
				top = rect.Bottom - 1 - (max - index) * BAND_HEADER_HEIGHT;
				bottom = rect.Bottom - 1 - (max - index - 1) * BAND_HEADER_HEIGHT;
			}
			else
			{
				top = rect.Top + 1 + index * BAND_HEADER_HEIGHT;
				bottom = rect.Top + 1 + (index+1) * BAND_HEADER_HEIGHT;
			}
			return  new Rectangle(rect.Left, top, rect.Width, bottom-top);
		}