1. Drawmode = OwnerDrawFixed <= 으로 설정
2. DrawItemEventArgs 생성
this.listBox1.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.listBox1_DrawItem);
// 그리기
private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
{
ListBox list = (ListBox)sender;
if (e.Index > -1)
{
Graphitem item = (Graphitem)list.Items[e.Index];
e.DrawBackground();
e.DrawFocusRectangle();
Brush brush = new SolidBrush(e.ForeColor);
SizeF size = e.Graphics.MeasureString(item.Name, e.Font);
e.Graphics.DrawImage(Properties.Resources.btn_realview, new Rectangle(new Point(0, e.Bounds.Top), new System.Drawing.Size(20, e.Bounds.Height)));
e.Graphics.DrawString(item.Name,
e.Font, brush, e.Bounds.Left + 20, e.Bounds.Top + (e.Bounds.Height / 2 - size.Height / 2));
}
}
- 대표 전화 : 02) 2061 - 0753 - Fax : 02) 2061 - 0759 - Skype : devzone24
- 주소 : 서울특별시 양천구 목1동 923-14. 현대드림타워 1024호
- 기술 문의: 02) 2061-1259 김민석 기술이사
댓글 없음:
댓글 쓰기