private void pickListMulti_DrawItem(object sender, DrawItemEventArgs e) { if (e.Index == -1) { e.DrawBackground(); return; } var g = e.Graphics; var bounds = e.Bounds; var choice = GetVisibleChoice(e.Index); // Draw checkbox var checkState = (choice.Chosen ? CheckBoxState.CheckedNormal : CheckBoxState.UncheckedNormal); var checkSize = CheckBoxRenderer.GetGlyphSize(g, checkState); var checkLocation = new Point(bounds.X + MARGIN_LEFT_CHECKBOX, bounds.Y + (bounds.Height - checkSize.Height) / 2); CheckBoxRenderer.DrawCheckBox(g, checkLocation, checkState); checkSize.Width += MARGIN_LEFT_CHECKBOX + MARGIN_RIGHT_CHECKBOX; bounds.X += checkSize.Width; bounds.Width -= checkSize.Width; // Draw images var imgPeak = _picker.GetPickPeakImage(choice.Choice); if (imgPeak != null) { g.DrawImageUnscaled(imgPeak, bounds.Left, bounds.Top, imgPeak.Width, bounds.Height); bounds.X += imgPeak.Width + MARGIN_RIGHT_IMAGE; bounds.Width -= imgPeak.Width + MARGIN_RIGHT_IMAGE; } var imgType = _picker.GetPickTypeImage(choice.Choice); g.DrawImageUnscaled(imgType, bounds.Left, bounds.Top, imgType.Width, bounds.Height); bounds.X += imgType.Width + MARGIN_RIGHT_IMAGE; bounds.Width -= imgType.Width + MARGIN_RIGHT_IMAGE; // Draw background and text clipped to remaining space var clipRect = g.ClipBounds; g.SetClip(bounds); e.DrawBackground(); if (!_picker.DrawPickLabel(choice.Choice, g, bounds, _modFonts, e.ForeColor, e.BackColor)) { TextRenderer.DrawText(e.Graphics, choice.Label, _modFonts.Plain, bounds, e.ForeColor, e.BackColor, FORMAT_PLAIN); } // Store the left edge of the text for use with tool tips _leftText = bounds.X; // Reset the clipping rectangle g.SetClip(clipRect); }