void OnPopup(object sender, PopupEventArgs e) { lines.Clear(); lines.Add(Item.Name); if (Item.MaxCount == 1) { lines.Add("Unique"); } List <string> classes = WoWHelper.Classes(Item.AllowableClass); if (classes.Count < 9) { lines.Add(Classes(classes)); } size.Width = 0; Size temp; foreach (string line in lines) { temp = TextRenderer.MeasureText(line, Font); if (temp.Width > size.Width) { size = temp; } } size.Height += 2; size.Height *= lines.Count; e.ToolTipSize = size; }
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); } }