procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
begin
//首先把combobox1的stytle属性设为csOwnerDrawFixed
//把要添加分割线的位置设为空行
//index=2对应的是一个空行
with combobox1.Canvas do
begin
if index=2 then
begin
//8是itemheight/2
MoveTo(0, rect.Top+8);
LineTo(rect.Right,rect.Top+8);
end else
TextOut((Rect.Left+1), (Rect.Top+1),Combobox1.Items.Strings[index]);
end;
end;