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

HighlightItem() private method

private HighlightItem ( int index, bool pressed ) : void
index int
pressed bool
return void
		void HighlightItem(int index, bool pressed)
		{
			// Exit if item state has not changed
			if ( lastHighlightedItem == index && previousPressed == pressed ) return;
			// Remember if we were pressed or not
			previousPressed = pressed;

			if ( lastHighlightedItem >= 0 )
			{
				// Draw the previously highlighted item in normal state
				using ( Graphics g = Graphics.FromHwnd(Handle) )
				{
					Rectangle itemRect = GetItemRect(g, bands[currentBandIndex], lastHighlightedItem, Rectangle.Empty);
					DrawItem(g, lastHighlightedItem, itemRect, false, false, Rectangle.Empty, null);
				}
			}

			lastHighlightedItem = index;
			if ( lastHighlightedItem >= 0 )
			{
				// Draw this item hightlighed
				using ( Graphics g = Graphics.FromHwnd(Handle) )
				{
					Rectangle itemRect = GetItemRect(g, bands[currentBandIndex], lastHighlightedItem, Rectangle.Empty);
					DrawItem(g, lastHighlightedItem, itemRect, true, pressed, Rectangle.Empty, null);
				}
			}
		}