unit UBackground;
interface
uses
Forms, Graphics;
type
TBackground =
class
private
fBackgroundColor: TColor;
fLineColor: TColor;
fDistance: Integer;
public
procedure Horizontal(AForm: TForm);
procedure Vertical(AForm: TForm);
property BackgroundColor: TColor
read fBackgroundColor
write fBackgroundColor;
property LineColor: TColor
read fLineColor
write fLineColor;
property Distance: integer
read fDistance
write fDistance;
end;
implementation
procedure TBackground.Horizontal(AForm: TForm);
var
lWidth, lHeight: integer;
begin
if assigned(AForm)
then
begin
AForm.Color := fBackgroundColor;
AForm.Canvas.Pen.Color := fLineColor;
lWidth := AForm.ClientWidth;
lHeight := AForm.ClientHeight;
while lHeight >= 0
do
begin
AForm.Canvas.MoveTo(0, lHeight);
AForm.Canvas.LineTo(lWidth, lHeight);
Dec(lWidth, fDistance);
end;
end;
end;
procedure TBackground.Vertical(AForm: TForm);
var
lWidth, lHeight: Integer;
begin
if assigned(AForm)
then
begin
AForm.Color := fBackgroundColor;
AForm.Canvas.Pen.Color := fLineColor;
lHeight := AForm.ClientHeight;
lWidth := AForm.ClientWidth;
while lWidth >= 0
do
begin
AForm.Canvas.MoveTo(lWidth, 0);
AForm.Canvas.LineTo(lWidth, lHeight);
Dec(lWidth, fDistance);
end;
end;
end;
end.