Autor Beitrag
Ironwulf
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 733
Erhaltene Danke: 2



BeitragVerfasst: So 22.01.06 00:37 
hy,
ich hab ein gauge mit der hintergrund farbe clred und der fordergrund farbe cllime, bei dem rot bekommt die schriftfarbe ein komisches blau und bei dem grün ebenfalls eine unschöne farbe, wenn ich jetz bei fontcolor clblack einstell verändert sich das kein bisschen, kann mir jemand sagen wie ich es hinbekomme das die schriftfarbe immer schwarz ist?
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: So 22.01.06 01:46 
Hallo,
bei der Gauge-Komponente wird die Schriftfarbe entsprechend der gewählten Vorder- bzw. Hintergrundfarbe automatisch angepasst. Diese Schriftfarbe kannst Du nicht ändern.

Entweder Du suchst Dir eine Komponente die das kann,
oder zeichnest Dir selbst einen Fortschrittsbalken.
Ein Beispiel:
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:
28:
29:
procedure PaintGauge(aPaintBox: TPaintBox;i: Integer);
var s : String;
begin
  s := IntToStr(i)+' %';
  with aPaintBox do
    begin
    Canvas.Brush.Color := clRed;
    Canvas.Pen.Color := clRed;
    Canvas.Rectangle(0,0,Round(Width*i/100),Height);
    Canvas.Brush.Color := clLime;
    Canvas.Pen.Color := clLime;
    Canvas.Rectangle(Round(Width*i/100),0,Width,Height);
    Canvas.Brush.Style := bsClear;
    Canvas.TextOut(Round(Width/2)-Round(Canvas.TextWidth(s)/2),    //x
                   Round(Height/2)-Round(Canvas.TextHeight(s)/2),  //y
                   s);
    Update;
    end;
end;

procedure TForm1.Button2Click(Sender: TObject);
var z : Integer;
begin
  for z := 0 to 100 do
    begin
     sleep(50);
     PaintGauge(PaintBox1,z);
    end;
end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Ironwulf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 733
Erhaltene Danke: 2



BeitragVerfasst: So 22.01.06 01:51 
jo ok danke :)
Ironwulf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 733
Erhaltene Danke: 2



BeitragVerfasst: So 22.01.06 17:17 
gibt da doch noch ein problem,
wenn ich die prozedur im onshow- event der form aufrufe passiert da nichts, sonst gehts eigentlich

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.FormShow(Sender: TObject);
begin
  GetVolume;         //berechnet die variable links
  Config.PaintBox;
end;

Procedure PaintBox; //Prozedur ein wenig abgeändert, im grunde trotzdem dasselbe ;D
var s: string;
begin
  s := IntToStr(Trunc(links * 100 / 65535));
  with Form1.PaintBox1 do
  begin
    Canvas.Brush.Color := clRed;
    Canvas.Pen.Color := clRed;
    Canvas.Rectangle(0,0,Width,Height);  //Hintergrund rot Färben
    Canvas.Brush.Color := clLime;
    Canvas.Pen.Color := clLime;
    Canvas.Rectangle(0,Height - Round(StrToInt(s) * Height / 100), Width, Height);
    Canvas.Brush.Style := bsClear;
    s:= s + ' %';
    Canvas.TextOut(Round(Width/2)-Round(Canvas.TextWidth(s)/2),    //x
                   Round(Height/2)-Round(Canvas.TextHeight(s)/2),  //y
                   s);
    Update;
  end;

end;
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: So 22.01.06 19:23 
Hallo,

setz den Code in OnActivate oder OnPaint,
dann sollte es funktionieren. :wink:

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Ironwulf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 733
Erhaltene Danke: 2



BeitragVerfasst: So 22.01.06 22:29 
ja danke, im onpaint gehts, im onactivate nich
hat das nen besondren warum das im onshow und onactivate nich geht?
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: So 22.01.06 22:55 
Hallo,

hier mal die Reihenfolge in der die Ereignisse ausgelöst werden:
• OnCreate
• OnShow
• OnActivate
• OnPaint

wenn Deine Zeichenroutine in OnShow steht, wird sie ausgeführt, aber nicht dargestellt,
weil in OnPaint das Formular erst gezeichnet wird.(richtig? :gruebel: )

Warum das im OnActivate bei Dir nicht geht kann ich Dir nicht sagen, bei mir funktioniert es.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )