Autor Beitrag
Becks16
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Do 27.01.05 09:49 
Hallo

Ich habe eine ComboBox mit 10 Einträgen und jetzt möchte ich jedem eintrag eine Farbe zuweisen.Kann mir dabei jemand helfen und mir sagen wie das geht.

vielen dank schon mal im vorraus

_________________
Ich bin Dumm und weiss nichts :-)
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 27.01.05 10:07 
Hallo

welöche Delphi-version hast du genau und wasverstehst du unter "Farbe zuweisen"

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Becks16 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Do 27.01.05 10:11 
Ich habe Delphi Enterprise...
Ich meine das so in der ComboBox sind zahlen drine 1,2,3 u.s.w nun möchte ich der zahl 1 einen hintergrund zuweisen wie z.b. gelb.

Mfg becks

_________________
Ich bin Dumm und weiss nichts :-)
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 27.01.05 10:15 
dann: quelltext der Tcolorbox/Tcustomcolorbox , methode drawitem anschauen. Desweiteren einfach mal die Forensuche Suche in: Delphi-Forum, Delphi-Library COMBOXBOX FARBE,Suche in: Delphi-Forum, Delphi-Library COMBOBOX DRAWITEM bemühen, wird nicht das erste mal gefragt ;).

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Becks16 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Do 27.01.05 10:25 
Da kann ich nicht mit anfangen bei ComboBox und Farbe hat er nicht gefunden.
ich habe jetzt das ereignis onDrawItem genommen. Wie muss ich jetzt weiter machen.

ComboBox3.Items ?? oder wie geht es nach ComboBox weiter oder ist das so total falsch ??

mfg

_________________
Ich bin Dumm und weiss nichts :-)
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Do 27.01.05 10:38 
hallo becks!

dann versuch mal --> ComboBox AND OnDrawItem
damit hab ich jede menge guter tipps gefunden
oder schau bei den --> schweizern vorbei - das ist auch nie verkehrt

mfg, stefan
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 27.01.05 10:51 
Becks16 hat folgendes geschrieben:
Da kann ich nicht mit anfangen bei ComboBox und Farbe

ich hab mich im suchtag verschreiben, hättest du aber auch selber merken können :roll:
Suche in: Delphi-Forum, Delphi-Library COMBOBOX FARBE
z.B. hier: www.delphi-forum.de/...light=combobox+farbe

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
grayfox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 800

win98, winXP
D4 Standard; D6 Personal
BeitragVerfasst: Do 27.01.05 10:55 
interessant wär auch ein tutorial mit dem titel
'wie finde ich das, was ich eigentlich suche?' :wink:

mfg, stefan
Becks16 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Do 27.01.05 10:58 
tut mir leid ich seh da nicht durch

_________________
Ich bin Dumm und weiss nichts :-)
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 27.01.05 13:01 
Becks16 hat folgendes geschrieben:
tut mir leid ich seh da nicht durch

es wäre besser, wenn du sagen würdest, wo du nicht durchsiehst...
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
begin
  with control as TCombobox do
    begin
      //wenn eintrag selektiert, dann selektiert hinterlegen, sonst farbig zeichnen
      if odselected in state then
        canvas.Brush.color := clHighlight
       else
        begin
          case index of
            0: canvas.Brush.color := clyellow;
            1: canvas.Brush.color := clred;
            2: canvas.Brush.color := clgreen;
            3: canvas.Brush.color := RGB(150,255,0);
            4,6: canvas.Brush.color := RGB(0,255,175);
            5,7..10: canvas.Brush.color := clLtGray;
           else
             canvas.Brush.color := clWindow;
           end;//of case
        end;
      //hintergrund zeichnen
      canvas.FillRect(rect);

      //text ausgeben
      canvas.textrect(rect,rect.Left+2,rect.Top+2,items[index]);
    end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
  ComboBox1.Style:=csOwnerDrawFixed;//wichtig!
end;

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)