AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Wie ein TComboBox Hintergrundfarbe ändern ?

Ein Thema von madina · begonnen am 2. Mär 2009 · letzter Beitrag vom 4. Mär 2009
 
Satty67

Registriert seit: 24. Feb 2007
Ort: Baden
1.566 Beiträge
 
Delphi 2007 Professional
 
#5

Re: Wie ein TComboBox Hintergrundfarbe ändern ?

  Alt 4. Mär 2009, 10:52
Hatte es jetzt schon geschrieben, Lerneffekt ist halt dadurch nur bei mir wirksam:
Delphi-Quellcode:
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
var
  FontColor,
  BackColor : TColor;
begin
  if odSelected in State then begin
    FontColor := clHighlightText;
    BackColor := clHighlight;
  end else if (Index mod 2 = 0) then begin
    FontColor := clBlack; // clWindowText
    BackColor := clWhite; // clWindow
  end else begin
    FontColor := clWhite;
    BackColor := clRed;
  end;

  with ComboBox1, ComboBox1.Canvas do begin
    Font.Color:= FontColor;
    Brush.Color:= BackColor;
    FillRect(Rect);
    TextOut(Rect.Left+5, Rect.Top, Items[index]);
  end;
end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:35 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz