Habe in einem anderen Forum dies gefunden, geht aber nicht;
Delphi-Quellcode:
procedure TMainForm.TntComboBox7DrawItem(Control: TWinControl;
Index: Integer; Rect: TRect; State: TOwnerDrawState);
begin
with tntcombobox7, tntcombobox7.Canvas do
begin
FillRect(rect);
if Items[index]='_line' then
begin
if odSelected in State then Pen.Color := clWindow
else Pen.Color := clBlack;
PenPos := Point(Rect.Left, Rect.Top+(ItemHeight div 2));
LineTo(Rect.Right, Rect.Top+(ItemHeight div 2));
end else
TextOut(rect.Left+2,rect.Top,Items[index]);
end;
end;
procedure TMainForm.TntComboBox7Click(Sender: TObject);
begin
if tntcombobox7.ItemIndex=0 then
output;
if tntcombobox7.ItemIndex=1 then
showinfopessoas;
if tntcombobox7.ItemIndex=2 then
showproddata;
if tntcombobox7.ItemIndex=3 then
showprodlinha;
end;
Style der Kombobox habe ich so geändert:
csOwnerDrawVariable