Autor Beitrag
Stinger47
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 102



BeitragVerfasst: Di 05.06.07 14:59 
hi...:)
so banal es klingen mag aber ich schaffe es nicht die schriftfarbe eines simplen buttons zu ändern...XD

ja eigentlich kann ich das und ja ich hab suche benutzt und nein es funktioniert net so...^^

hier mal der code muss also daran liegen...^^

ausblenden 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:
procedure TForm1.SetMyIcon(BTN_Name: TButton);
begin

  if BTN_Name.Caption = '' then
    begin

      if Player = TRUE then
        begin
          BTN_Name.Font.Color :=    clLime;
          BTN_Name.Caption    :=    'X';
          BTN_Name.Tag        :=    1;
          Runde               :=    Runde + 1;
        end;

      if Player = False then
        begin
          BTN_Name.Font.Color :=    clRed;
          BTN_Name.Caption    :=    'O';
          BTN_Name.Tag        :=    0;
          Runde               :=    Runde + 1;
        end;

      Player    :=    not Player;

    end;

end;


danke schonmal für alle antworten...:)
glaub ich habs heut nicht so...^^
Stinger47 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 102



BeitragVerfasst: Di 05.06.07 15:06 
hat sich erledigt...hab doch noch was gefunden...^^
sry für post
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Di 05.06.07 15:10 
Hallo,
user profile iconStinger47 hat folgendes geschrieben:
hat sich erledigt...hab doch noch was gefunden...^^
sry für post
was hast Du denn gefunden, Einen TSpeedButton? :wink:

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Stefan.Buchholtz
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 612

WIN 2000, WIN XP, Mac OS X
D7 Enterprise, XCode, Eclipse, Ruby On Rails
BeitragVerfasst: Di 05.06.07 15:14 
Deine Bedingung kann man aber ordentlich verkürzen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
   
  if Player then  
  begin  
    BTN_Name.Font.Color :=    clLime;  
    BTN_Name.Caption    :=    'X';  
    BTN_Name.Tag        :=    1;  
  end
  else        
  begin  
    BTN_Name.Font.Color :=    clRed;  
    BTN_Name.Caption    :=    'O';  
    BTN_Name.Tag        :=    0;  
  end;  
  Inc(Runde);


Player ist ja schon ein Boolean, also musst du ihn nicht mit true oder false vergleichen. Und wenn er nicht true ist, muss er false sein, also kannst du den Fall im else-Zweig abdecken statt noch eine if-Abfrage zu machen.

Stefan

_________________
Ein Computer ohne Windows ist wie eine Schokoladentorte ohne Senf.