示例#1
0
        protected override void DrawCloseButton(TabItemPaintEventArgs e, Rectangle rect)
        {
            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 bs = e.CloseButtonStatus;

            if (!e.Selected)
            {
                if (bs == UIControlStatus.Hover || bs == UIControlStatus.Selected)
                {
                    bs = UIControlStatus.InactivedHover;
                }
                else
                {
                    bs = UIControlStatus.Inactived;
                }
            }

            img.Draw(e.Graphics, bs, rect);
        }
示例#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 static UIStatusImage FromVertical(Image image, int sliceSize, UIControlStatus[] status)
        {
            var img = new UIStatusImage(image);

            img.SliceSize = new Size(0, sliceSize);

            if (status != null)
            {
                int p = 0;
                foreach (var s in status)
                {
                    img.SlicesLocation[s] = new Point(0, p);
                    p += sliceSize;
                }
            }

            return(img);
        }