Autor Beitrag
swbo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mo 03.07.06 11:34 
Hallo,

wie kann man bewerkstelligen, dass wenn ich auf eine Schaltfläche klicke, dann diese die Farbe ändert? Danke.


Moderiert von user profile iconUGrohne: Topic aus Sonstiges (Delphi) verschoben am Mo 03.07.2006 um 12:19
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mo 03.07.06 12:42 
Du gehst in das OnClickEriegnis des Button und weißt ihm darin eine neue Farbe zu z.B

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure form1_Button1_klick(Sender:TObject);
begin
  Button1.Font.Colour:=clRed;
end;
swbo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Di 04.07.06 19:30 
Sorry, das scheint aber so nicht zu funktionieren. Jedenfalls bei mir nicht. Gibt es nicht die Möglichkeit - TButton die Eigenschaft Color zu verpassen?
Hack Gott
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 409

Windows Vista
Delphi 2005 Personal, Delphi 7
BeitragVerfasst: Di 04.07.06 19:33 
Verwend einfach keinen Button! Das ist einfacher! Benutz ein Label.

Zum obigen Code, der ändert nur die Schriftfarbe, nicht den Button.

_________________
"Je mehr Käse, desto mehr Löcher; Je mehr Löcher, desto weniger Käse. Daraus folgt: Je mehr Käse desto weniger Käse!"
swbo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Di 04.07.06 19:44 
Danke, ist auch'ne Idee ...

Ich habe auch was gefunden ...

www.delphipraxis.net...ghlight=button+color
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mi 05.07.06 09:50 
Stimmt die Hintergrundfarbe war glaube ich bei TSpeedbuttoneinfacher zu ändern.
swbo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mi 05.07.06 14:12 
Mh..? Die Eigenschaft "Color" fehlt aber auch bei TSpeedButton1.
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Mi 05.07.06 14:18 
TSpeedButton1 gibts nicht. Entweder SpeedButton1 als Variable oder die Klasse TSpeedButton

_________________
Programmers never die, they just GOSUB without RETURN
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Di 11.07.06 08:44 
Ich muss gestehen, dass ich bei keiner xyz StandartButton Komponente eine Eigenschaft Colouroder BackColourgefunden habe. Aber ich weiß, das das mal ging und zwar ohne Tricks, man musste aber noch irgendwo was umstelllen...
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Di 11.07.06 11:54 
man kann auch ein TPanel nehmen, und ggf. im mousedown/up bevelouter/bevelinner setzen um den 3d-klickeffekt hinzubekommen. Farben ändern geht auch ;)
evtl. leitet man sich ne eigene klasse davon ab um MouseEnter und MouseLeave noch hinzuzufügen.

Gruß Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mi 12.07.06 09:31 
Ja aber nativ unterstützen die Buttons (also die Win32 Common Controls) das nicht? Ich meinte unter VB wäre das immer ganz einfach gewesen :-/