/// <summary> /// Gets the group image. /// </summary> /// <param name="group">The group.</param> /// <returns></returns> private Image GetGroupImage(KillLogFittingContentGroup group) { switch (group) { case KillLogFittingContentGroup.Cargo: case KillLogFittingContentGroup.Other: return(imageList.Images[1]); case KillLogFittingContentGroup.HighSlot: return(imageList.Images[2]); case KillLogFittingContentGroup.MediumSlot: return(imageList.Images[3]); case KillLogFittingContentGroup.LowSlot: return(imageList.Images[4]); case KillLogFittingContentGroup.RigSlot: return(imageList.Images[5]); case KillLogFittingContentGroup.SubsystemSlot: return(imageList.Images[6]); case KillLogFittingContentGroup.DroneBay: return(imageList.Images[0]); case KillLogFittingContentGroup.Implant: case KillLogFittingContentGroup.Booster: return(imageList.Images[8]); default: return(imageList.Images[0]); } }
/// <summary> /// Draws the list item for the given group. /// </summary> /// <param name="group"></param> /// <param name="e"></param> private void DrawItem(KillLogFittingContentGroup group, DrawItemEventArgs e) { Graphics g = e.Graphics; using (Brush brush = Settings.UI.SafeForWork ? new SolidBrush(Color.FromArgb(75, 75, 75)) : (Brush) new LinearGradientBrush(new PointF(0F, 0F), new PointF(0F, FittingDetailHeight), Color.FromArgb(75, 75, 75), Color.FromArgb(25, 25, 25))) { g.FillRectangle(brush, e.Bounds); } using (Pen pen = new Pen(Color.FromArgb(100, 100, 100))) { g.DrawLine(pen, e.Bounds.Left, e.Bounds.Top, e.Bounds.Right + 1, e.Bounds.Top); } Size fittingGroupTextSize = TextRenderer.MeasureText(g, group.GetDescription(), m_fittingBoldFont, Size.Empty, Format); Rectangle fittingGroupTextRect = new Rectangle(e.Bounds.Left + PadLeft / 3 + ItemImageSize, e.Bounds.Top + (e.Bounds.Height - fittingGroupTextSize.Height) / 2, fittingGroupTextSize.Width + PadRight, fittingGroupTextSize.Height); TextRenderer.DrawText(g, group.GetDescription(), m_fittingBoldFont, fittingGroupTextRect, Color.White); // Draw the group image if (Settings.UI.SafeForWork) { return; } Rectangle fittingGroupImageRect = new Rectangle(e.Bounds.Left + PadLeft / 3, e.Bounds.Top + (e.Bounds.Height - ItemImageSize) / 2, ItemImageSize, ItemImageSize); g.DrawImage(GetGroupImage(group), fittingGroupImageRect); }
/// <summary> /// Gets the group image. /// </summary> /// <param name="group">The group.</param> /// <returns></returns> private Image GetGroupImage(KillLogFittingContentGroup group) { switch (group) { case KillLogFittingContentGroup.Cargo: case KillLogFittingContentGroup.Other: return imageList.Images[1]; case KillLogFittingContentGroup.HighSlot: return imageList.Images[2]; case KillLogFittingContentGroup.MediumSlot: return imageList.Images[3]; case KillLogFittingContentGroup.LowSlot: return imageList.Images[4]; case KillLogFittingContentGroup.RigSlot: return imageList.Images[5]; case KillLogFittingContentGroup.SubsystemSlot: return imageList.Images[6]; case KillLogFittingContentGroup.DroneBay: return imageList.Images[0]; case KillLogFittingContentGroup.Implant: case KillLogFittingContentGroup.Booster: return imageList.Images[8]; default: return imageList.Images[0]; } }
/// <summary> /// Draws the list item for the given group. /// </summary> /// <param name="group"></param> /// <param name="e"></param> private void DrawItem(KillLogFittingContentGroup group, DrawItemEventArgs e) { Graphics g = e.Graphics; using (Brush brush = Settings.UI.SafeForWork ? new SolidBrush(Color.FromArgb(75, 75, 75)) : (Brush)new LinearGradientBrush(new PointF(0F, 0F), new PointF(0F, FittingDetailHeight), Color.FromArgb(75, 75, 75), Color.FromArgb(25, 25, 25))) { g.FillRectangle(brush, e.Bounds); } using (Pen pen = new Pen(Color.FromArgb(100, 100, 100))) { g.DrawLine(pen, e.Bounds.Left, e.Bounds.Top, e.Bounds.Right + 1, e.Bounds.Top); } Size fittingGroupTextSize = TextRenderer.MeasureText(g, group.GetDescription(), m_fittingBoldFont, Size.Empty, Format); Rectangle fittingGroupTextRect = new Rectangle(e.Bounds.Left + PadLeft / 3 + ItemImageSize, e.Bounds.Top + (e.Bounds.Height - fittingGroupTextSize.Height) / 2, fittingGroupTextSize.Width + PadRight, fittingGroupTextSize.Height); TextRenderer.DrawText(g, group.GetDescription(), m_fittingBoldFont, fittingGroupTextRect, Color.White); // Draw the group image if (Settings.UI.SafeForWork) return; Rectangle fittingGroupImageRect = new Rectangle(e.Bounds.Left + PadLeft / 3, e.Bounds.Top + (e.Bounds.Height - ItemImageSize) / 2, ItemImageSize, ItemImageSize); g.DrawImage(GetGroupImage(group), fittingGroupImageRect); }