Beispiel #1
0
		private void ItemMouseDown(ToolboxItem item)
		{
			if(item.Selected==false)
			{
				if(_selectedItem!=null)
				{
					_selectedItem.Selected=false;
					Invalidate(GetItemRect(_selectedItem));
				}
				item.Selected=true;
				Invalidate(GetItemRect(item));
				_selectedItem=item;

				if(OnSelectedItemChanged!=null)
				{
					OnSelectedItemChanged(this, EventArgs.Empty);
				}

			}
		}
Beispiel #2
0
		private void PaintItem(Graphics graphics, ToolboxItem item, SolidBrush backgroundBrush, ref int offset)
		{
			item.Top=offset;
			offset+=19;

			SolidBrush itemBrush=null;
			if(item.MouseOver&&item.Selected)
			{
				itemBrush=new SolidBrush(_selectedMouseOverColor);
			}
			else if(item.MouseOver)
			{
				itemBrush=new SolidBrush(_mouseOverColor);
			}
			else if(item.Selected)
			{
				itemBrush=new SolidBrush(_selectedItemColor);
			}

			if(itemBrush!=null)
			{
				PaintItemBackground(graphics, itemBrush, item.Top);
			}

			if(_images!=null&&
				item.IconIndex>=0&&
				item.IconIndex<_images.Images.Count)
			{
				_images.Draw(graphics,
					new Point(8, item.Top+1),
					item.IconIndex);
			}

			if(item.Caption.Length>0)
			{
				graphics.DrawString(item.Caption,
					this.Font,
					Brushes.Black,
					new RectangleF(26, item.Top+2, this.Width-30, item.Top+13));
			}

		}