Du könntest es ja so machen (vielleicht ein bisschen umständlich, aber es funktioniert):
Zuerst schreibst du in deine Combobox (Items) alle möglichen Farben rein (also Schwraz, Weiß, Rot, Gelb,... und dann schreibst du das in den SourceCode:
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: 33: 34:
| var col: TColor;
procedure TForm1.getcolor(Sender: Tobject); begin with TCombobox(Sender) do begin case itemindex of 0: col:= clBlack; 1: col:= clWhite; 2: col:= clRed; 3: col:= clYellow; 4: col:= clBlue; 5: col:= clGreen; 6: col:= clPurple; 7: col:= clFuchsia; 8: col:= clGray; 9: col:= clSilver; 10: col:= clLime; 11: col:= clOlive; 12: col:= clTeal; 13: col:= clAqua; 14: col:= clNavy; 15: col:= clSkyBlue; 16: col:= clMaroon; end; end; end;
procedure TForm1.ComboBox1Click(Sender: TObject); begin getcolor(Combobox1); memo1.color:=col; end; |
Habs jetzt nicht getestet, müsste aber so hinhauen.
mfG
Tomac