Пример #1
0
        protected virtual bool OnPaint(ThumbViewPaintEventArgs e)
        {
            e.PaintBackground();

            // text
            var textHeight = e.Font.Height + 6;
            var rectText   = new Rectangle(Left, Bottom - textHeight, Width, textHeight);

            if (!string.IsNullOrEmpty(Text))
            {
                var sf = PaintHelper.SFCenter;
                sf.Trimming     = StringTrimming.EllipsisCharacter;
                sf.FormatFlags |= StringFormatFlags.NoWrap;

                e.Graphics.DrawString(Text,
                                      e.Font,
                                      Selected ? new SolidBrush(e.View.ActiveCellForeColor) : new SolidBrush(e.View.CellForeColor),
                                      rectText,
                                      sf);
            }

            // image
            if (Image != null)
            {
                var rectImg = new Rectangle(Left, Top, Width, Height - textHeight - 4);
                PaintHelper.DrawImageInRange(e.Graphics, Image, rectImg);
            }

            return(true);
        }
Пример #2
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);
            }
        }
Пример #3
0
        protected override bool OnPaint(ThumbViewPaintEventArgs e)
        {
            if (base.OnPaint(e))
            {
                if (FileIcon != null && FileImageIsValid)
                {
                    e.Graphics.DrawImage(FileIcon, Left + 10, Top + 10);
                }
                return(true);
            }

            return(false);
        }
Пример #4
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);
            }
        }
Пример #5
0
 internal bool NotifyPaint(ThumbViewPaintEventArgs e)
 {
     return(OnPaint(e));
 }