private void lstMembers_DrawItem(object sender, DrawItemEventArgs e)
{
try
{
if (e.Index == -1)
return;
int c = lstMembers.Items.Count;
SizeF s = e.Graphics.MeasureString(c.ToString(), lstMembers.Font);
var maxwidth = (int) s.Width;
if (maxwidth < 16 + 2)
maxwidth = 16 + 2;
var r = new Rectangle(0, e.Bounds.Top, maxwidth, lstMembers.ItemHeight);
bool SupportPaint = Editor.GetPaintValueSupported();
int w = SupportPaint ? 20 : 0;
var rcItem = new Rectangle(r.Right + w, r.Top, e.Bounds.Width - r.Right - w, lstMembers.ItemHeight);
ControlPaint.DrawBorder3D(e.Graphics, r, Border3DStyle.Raised, Border3DSide.All);
StringFormat sf = StringFormat.GenericDefault;
sf.Alignment = StringAlignment.Far;
r.Inflate(-1, -1);
e.Graphics.DrawString(e.Index.ToString(), lstMembers.Font, Brushes.Black, r, sf);
bool Selected = ((int) e.State & (int) DrawItemState.Selected) != 0;
using (SolidBrush bg = GetBgBrush(Selected))
using (SolidBrush fg = GetFgBrush(Selected))
{
e.Graphics.FillRectangle(bg, rcItem);
if (Selected && e.Index != -1)
{
if (((int) e.State & (int) DrawItemState.Focus) != 0)
{
ControlPaint.DrawFocusRectangle(e.Graphics, rcItem);
}
}
if (e.Index >= 0)
{
object o = lstMembers.Items[e.Index];
string name = GetDisplayText(o);
e.Graphics.DrawString(name, lstMembers.Font, fg, rcItem);
}
}
}
catch { }
}