Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Colors in ComboBox (https://www.delphipraxis.net/36694-colors-combobox.html)

Nils_13 23. Dez 2004 17:47


Colors in ComboBox
 
Hi,

wenn ich den folgenden Code verwende, vertauscht mir mein Prog immer die Farben versteht ihr den Fehler?
Delphi-Quellcode:
function TForm1.CurrText: TTextAttributes;
begin
  if edit.SelLength > 0 then Result := edit.SelAttributes
  else Result := edit.DefAttributes;
end;

function TForm1.GetColor(idx: Integer): TColor;
begin
    case idx of
      0 : result := clBlack;
      1 : result := clMaroon;
      2 : result := clGreen;
      3 : result := clOlive;
      4 : result := clNavy;
      5 : result := clPurple;
      6 : result := clGray;
      7 : result := clSilver;
      8 : result := clRed;
      9 : result := clLime;
      10 : result := clYellow;
      11 : result := clFuchsia;
      12 : result := clAqua;
      13 : result := clWhite;
      14 : result := clScrollBar;
      15 : result := clBackground;
    end;
end;

// ComboBox
procedure TForm1.ColorChange(Sender: TObject);
begin
CurrText.Color := CurrText.Color + getcolor(Color.ItemIndex);
end;
Der Rest vom Prog funzt schon, nur noch das eine Problem.

Luckie 23. Dez 2004 17:53

Re: Colors in ComboBox
 
Was verstehst du unter vertauschen?
Hier
Delphi-Quellcode:
CurrText.Color := CurrText.Color + getcolor(Color.ItemIndex);
ddierst du ja zur aktuellen Farbe, die selektierte, wenn mich nicht alles täuscht.

Nils_13 23. Dez 2004 17:56

Re: Colors in ComboBox
 
:oops:

thx!


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:00 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz