Ejemplo n.º 1
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            ToolboxItemBase item = HitTest(e.Location);

            if (e.Button == MouseButtons.Left && item is ToolboxItem)
            {
                ToolboxItem toolboxItem = item as ToolboxItem;
                if (toolboxItem.Data != null)
                {
                    this.DoDragDrop(toolboxItem.Data, DragDropEffects.Copy);
                }
            }
            else
            {
                if (item != null && item.MouseOver == false)
                {
                    if (currentMouseOverItem != null)
                    {
                        currentMouseOverItem.MouseOver = false;
                        Invalidate(GetItemRect(currentMouseOverItem));
                    }
                    item.MouseOver = true;
                    Invalidate(GetItemRect(item));
                    currentMouseOverItem = item;
                }
            }

            base.OnMouseMove(e);
        }
Ejemplo n.º 2
0
 protected override void OnMouseLeave(EventArgs e)
 {
     base.OnMouseLeave(e);
     if (currentMouseOverItem != null)
     {
         currentMouseOverItem.MouseOver = false;
         Invalidate(GetItemRect(currentMouseOverItem));
         currentMouseOverItem = null;
     }
 }
Ejemplo n.º 3
0
        private bool PointOverToolboxItem(Point point, ToolboxItemBase item)
        {
            if (item.Top == -1)
            {
                return(false);
            }

            if (point.Y >= item.Top && point.Y <= item.Top + 18)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            ToolboxItemBase item = HitTest(e.Location);

            if (item is ToolboxItem)
            {
                ItemMouseDown(item as ToolboxItem);
            }
            else if (item is ToolboxGroup)
            {
                GroupMouseDown(item as ToolboxGroup);
            }

            base.OnMouseDown(e);
        }
Ejemplo n.º 5
0
 private Rectangle GetItemRect(ToolboxItemBase item)
 {
     return(new Rectangle(0, item.Top, this.Width, 19));
 }