示例#1
0
 public ThumbViewPaintEventArgs(ThumbView view, Graphics graphics, ThumbItem item, Font font)
 {
     View     = view;
     Graphics = graphics;
     Item     = item;
     Font     = font;
 }
示例#2
0
        void PaintItemCloseButton(PaintEventArgs e, ThumbItem item)
        {
            if (item != HoverObject.Item)
            {
                return;
            }

            Image         image = Properties.Resources.taskbar_close_button;
            UIStatusImage img   = UIStatusImage.FromVertical(image,
                                                             new UIControlStatus[] {
                UIControlStatus.Normal,
                UIControlStatus.Hover,
                UIControlStatus.Selected,
                UIControlStatus.InactivedHover,
                UIControlStatus.Inactived,
                UIControlStatus.Disabled
            });

            var rect = GetItemCloseButtonRectangle(item);
            var bs   = UIControlStatus.Normal;

            if (PressedObject.Item == item && PressedObject.IsCloseButton)
            {
                bs = UIControlStatus.Selected;
            }
            else if (HoverObject.Item == item && HoverObject.IsCloseButton)
            {
                bs = UIControlStatus.Hover;
            }

            img.Draw(e.Graphics, bs, rect);
        }
示例#3
0
 public HitResult(int x, int y, ThumbItem item)
 {
     X             = x;
     Y             = y;
     Item          = item;
     IsCloseButton = false;
 }
示例#4
0
        void PaintItem(PaintEventArgs e, ThumbItem item)
        {
            ThumbViewPaintEventArgs args = new ThumbViewPaintEventArgs(this, e.Graphics, item, Font);

            if (!item.NotifyPaint(args))
            {
                PaintCellBackground(args, item);

                Color foreColor;
                if (item == HoverObject.Item)
                {
                    foreColor = ActiveCellForeColor;
                }
                else
                {
                    foreColor = CellForeColor;
                }

                if (!string.IsNullOrEmpty(item.Text))
                {
                    Font font = new Font(UITheme.Default.DefaultFont.FontFamily, 16);
                    e.Graphics.DrawString(item.Text, font, new SolidBrush(foreColor), item.Bounds, PaintHelper.SFCenter);
                }
            }

            // close button
            if (item.CanClose)
            {
                PaintItemCloseButton(e, item);
            }
        }
示例#5
0
 void Invalidate(ThumbItem item)
 {
     if (item != null)
     {
         Invalidate(item.Bounds);
     }
 }
示例#6
0
        protected virtual void OnItemClick(ThumbItem item)
        {
            item.NotifyClick();

            if (ItemClick != null)
            {
                ItemClick(this, new ThumbViewItemEventArgs(item));
            }
        }
示例#7
0
        Rectangle GetItemCloseButtonRectangle(ThumbItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException();
            }

            return(new Rectangle(item.Right - 16, item.Top, 16, 16));
        }
示例#8
0
        internal void PaintCellBackground(ThumbViewPaintEventArgs e, ThumbItem item)
        {
            Color backColor;

            if (item == HoverObject.Item)
            {
                backColor = ActiveCellBackColor;
            }
            else
            {
                backColor = CellBackColor;
            }

            if (!backColor.IsEmpty)
            {
                e.Graphics.FillRectangle(new SolidBrush(backColor), item.Bounds);
            }
        }
示例#9
0
        void OnItemClose(ThumbItem item)
        {
            if (item == null)
            {
                throw new ArgumentNullException();
            }

            //
            if (Items.Contains(item))
            {
                var e = new ThumbViewItemCancelEventArgs(item);
                OnItemClosing(e);
                if (e.Cancel)
                {
                    return;
                }

                Items.Remove(item);

                var e2 = new ThumbViewItemEventArgs(item);
                OnItemClosed(e2);
            }
        }
示例#10
0
 public ThumbViewItemEventArgs(ThumbItem item)
 {
     Item = item;
 }