Autor Beitrag
ALF
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1085
Erhaltene Danke: 53

WinXP, Win7, Win10
Delphi 7 Enterprise, XE
BeitragVerfasst: Di 29.06.10 13:24 
Hi, ob das Topic richtig ist?
Mein Problem ist eigentlich mathematisch :mrgreen:
Ich möchte die Farbwerte in Abhängigkeit von der Höhe der Paintbox machen.Der Endwert der Farbe soll dann 255 sein
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
for y:=0 to PaintBox1.Height-1 do
  begin
    paintbox1.Canvas.Pen.Color:=RGB(133+y,135+y,148+y);//<--hie rmüsste also ne Formel hin?
    PaintBox1.Canvas.MoveTo(PaintBox1.Left,PaintBox1.Top+y);
    PaintBox1.Canvas.LineTo(PaintBox1.Width,PaintBox1.Top+y);
  end;

Fragt mich nicht, was ich alles versucht/gesucht habe!? Problem ist ja das ich nie den Endwert von 255 erreiche.
Die Werte sind ja abhängig von der Höhe, Startwert zb. 133 zu Endwert 255 prozentual zur Höhe, oder so.
Habs also nicht gepackt die logik zu erkennen :cry:

Gruss Alf

_________________
Wenn jeder alles kann oder wüsste und keiner hätt' ne Frage mehr, omg, währe dieses Forum leer!
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Di 29.06.10 13:57 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
  y:Integer;
begin
for y:=0 to PaintBox1.Height-1 do
  begin

    paintbox1.Canvas.Pen.Color:=RGB( Trunc(133+ (255 - 133) / PaintBox1.Height *y) , Trunc(135+ (255 - 133) / PaintBox1.Height *y) , Trunc(148+ (255 - 133) / PaintBox1.Height *y) );//<--hie rmüsste also ne Formel hin?
    PaintBox1.Canvas.MoveTo(PaintBox1.Left,PaintBox1.Top+y);
    PaintBox1.Canvas.LineTo(PaintBox1.Width,PaintBox1.Top+y);
  end;
end;

Für diesen Beitrag haben gedankt: ALF
ALF Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1085
Erhaltene Danke: 53

WinXP, Win7, Win10
Delphi 7 Enterprise, XE
BeitragVerfasst: Di 29.06.10 14:11 
Nice :beer:
Seit 3 Tagen fumle ich daran :shock:
kleine Korektur noch von mir8) , wegen C&P, funct aber Super!

Danke!!!!

Gruss Alf

_________________
Wenn jeder alles kann oder wüsste und keiner hätt' ne Frage mehr, omg, währe dieses Forum leer!