private void dbg_drawitem(object sender, DrawItemEventArgs e) { colourItem item = dbgList.Items[e.Index] as colourItem; if (item != null) { e.Graphics.DrawString(item.Message, dbgList.Font, new SolidBrush(item.ItemColor), 0, e.Index * dbgList.ItemHeight); } else { } }
private void oDraw(object sender, DrawItemEventArgs e) { colourItem item = output.Items[e.Index] as colourItem; if (item != null) { Bitmap tmbmp = new Bitmap(1, 1); Graphics g = Graphics.FromImage(tmbmp); int width = (int)g.MeasureString(item.Message, output.Font).Width; e.Graphics.DrawString(item.Message, output.Font, new SolidBrush(item.ItemColor), ((output.Width / 2) - (width / 2)), e.Index * output.ItemHeight); g.Dispose(); tmbmp.Dispose(); } else { } }