protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (e.Index >= Items.Count || e.Index <= -1)
            {
                return;
            }
            ItemsItem item = (ItemsItem)Items[e.Index];

            if (item == null)
            {
                return;
            }
            Graphics graphics = e.Graphics;

            graphics.FillRectangle((e.State & DrawItemState.Selected) == DrawItemState.Selected ? new SolidBrush(Color.FromArgb(75, 75, 75)) : new SolidBrush(BackColor), e.Bounds);
            Bitmap icon = new Bitmap(@"Icons\" + item.Icon + ".png");

            icon = new Bitmap(icon, e.Bounds.Height, e.Bounds.Height);
            graphics.FillRectangle(new TextureBrush(icon), e.Bounds.X, e.Bounds.Y, e.Bounds.Height, e.Bounds.Height);
            SizeF stringSize = graphics.MeasureString(item.Name, Font);
            Font  font       = (e.State & DrawItemState.Selected) == DrawItemState.Selected ? bold : Font;
            Color color      = item.Name == "None" ? Color.White : WoWHelper.QalityColor(item.Quality);

            graphics.DrawString(item.Name, font, new SolidBrush(color), 15, e.Bounds.Y + (e.Bounds.Height - stringSize.Height) / 2);
        }
Esempio n. 2
0
        void OnDraw(object sender, DrawToolTipEventArgs e)
        {
            int      y        = 0;
            Graphics graphics = e.Graphics;

            graphics.FillRectangle(new SolidBrush(BackColor), e.Bounds);
            graphics.DrawRectangle(new Pen(Color.FromArgb(75, 75, 75)), new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1));
            graphics.DrawString(lines[y], Font, new SolidBrush(WoWHelper.QalityColor(Item.Quality)), new PointF(3, 1 + 14 * y++));
            if (Item.MaxCount == 1)
            {
                graphics.DrawString(lines[y], Font, new SolidBrush(ForeColor), new PointF(3, 1 + 14 * y++));
            }
            List <string> classes = WoWHelper.Classes(Item.AllowableClass);

            if (classes.Count < 9)
            {
                DrawClasses(lines[y].Split(' '), y, graphics);
            }
        }