public ThumbViewPaintEventArgs(ThumbView view, Graphics graphics, ThumbItem item, Font font) { View = view; Graphics = graphics; Item = item; Font = font; }
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); }
public HitResult(int x, int y, ThumbItem item) { X = x; Y = y; Item = item; IsCloseButton = false; }
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); } }
void Invalidate(ThumbItem item) { if (item != null) { Invalidate(item.Bounds); } }
protected virtual void OnItemClick(ThumbItem item) { item.NotifyClick(); if (ItemClick != null) { ItemClick(this, new ThumbViewItemEventArgs(item)); } }
Rectangle GetItemCloseButtonRectangle(ThumbItem item) { if (item == null) { throw new ArgumentNullException(); } return(new Rectangle(item.Right - 16, item.Top, 16, 16)); }
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); } }
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); } }
public ThumbViewItemEventArgs(ThumbItem item) { Item = item; }