SidebarLibrary.Menus.MenuControl.SwitchTrackingItem C# (CSharp) Method

SwitchTrackingItem() protected method

protected SwitchTrackingItem ( int oldItem, int newItem ) : int
oldItem int
newItem int
return int
		protected int SwitchTrackingItem(int oldItem, int newItem)
		{
			// Create a graphics object for drawinh
			using(Graphics g = this.CreateGraphics())
			{
				// Deselect the old draw command
				if (oldItem != -1)
				{
					//DrawCommand dc = _drawCommands[oldItem] as DrawCommand;

					// Draw old item not selected
					DrawSingleCommand(g, _drawCommands[oldItem] as DrawCommand, false);
				}

				_trackItem = newItem;

				// Select the new draw command
				if (_trackItem != -1)
				{
					//DrawCommand dc = _drawCommands[_trackItem] as DrawCommand;

					// Draw new item selected
					DrawSingleCommand(g, _drawCommands[_trackItem] as DrawCommand, true);
				}
			}

			return _trackItem;
		}