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: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81:
| procedure TForm1.DrawIt; var Panel : TPanel; hoehe_Kopf : Integer;
Y, R, G, B: Integer; ix : Integer;
RColor1, GColor1, BColor1: Integer; RColor2, GColor2, BColor2: Integer;
RColor3, GColor3, BColor3: Integer; RColor4, GColor4, BColor4: Integer;
Color1,Color2,Color3,Color4 : TColor;
begin Panel := TPanel.Create(self); Panel.Parent := self; Panel.BevelInner := bvLowered; Panel.BevelOuter := bvRaised; Panel.Height := 337; Panel.Width := 337; Panel.Color := clwhite; Panel.Left := 50; Panel.Top := 50; Panel.Repaint;
Color1:=ColorToRGB($00FDF8F2); Color2:=ColorToRGB($00F1D5B8);
RColor1:=GetRValue(Color1); GColor1:=GetGValue(Color1); BColor1:=GetBValue(Color1);
RColor2:=GetRValue(Color2); GColor2:=GetGValue(Color2); BColor2:=GetBValue(Color2);
Color3:=ColorToRGB($00EDC69E); Color4:=ColorToRGB($00F1D5B8);
RColor3:=GetRValue(Color3); GColor3:=GetGValue(Color3); BColor3:=GetBValue(Color3);
RColor4:=GetRValue(Color4); GColor4:=GetGValue(Color4); BColor4:=GetBValue(Color4);
TMyPanel(Panel).Canvas.Pen.Width:=1; TMyPanel(Panel).Canvas.Pen.Style:=psInsideFrame;
ix := 0;
hoehe_Kopf := 25;
for Y:= Panel.ClientRect.Top to hoehe_Kopf do begin
If y <= (hoehe_Kopf div 2 ) then begin R:=Round(RColor1 + ((RColor2 - RColor1) * Y / ((hoehe_Kopf div 2 ) - Panel.ClientRect.Top))); G:=Round(GColor1 + ((GColor2 - GColor1) * Y / ((hoehe_Kopf div 2 )- Panel.ClientRect.Top))); B:=Round(BColor1 + ((BColor2 - BColor1) * Y / ((hoehe_Kopf div 2 )- Panel.ClientRect.Top))); end else begin inc(ix); R:=Round(RColor3 + ((RColor4 - RColor3) * ix / (hoehe_Kopf - (hoehe_Kopf div 2 )))); G:=Round(GColor3 + ((GColor4 - GColor3) * ix / (hoehe_Kopf- (hoehe_Kopf div 2 )))); B:=Round(BColor3 + ((BColor4 - BColor3) * ix / (hoehe_Kopf- (hoehe_Kopf div 2 )))); end;
TMyPanel(Panel).Canvas.Brush.Color:=RGB(R, G, B); TMyPanel(Panel).Canvas.FillRect(Classes.Rect(Panel.ClientRect.Left, Y, Panel.ClientRect.Right, Y+1));
end; end; |