Einzelnen Beitrag anzeigen

tom_po

Registriert seit: 5. Feb 2006
137 Beiträge
 
Delphi 7 Enterprise
 
#2

Re: In Combobox Linien einfügen

  Alt 14. Feb 2006, 18:18
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]='_linethen
    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
  Mit Zitat antworten Zitat