How to put shadow on a label in Delphi?

0

Hello, I wanted to know how to put shadow on a label in Delphi like this one in the image below:

    
asked by anonymous 21.06.2015 / 03:27

1 answer

1

Dude, I think this only has components from third parties, at most I have a shadow example, but this is not what you show us.

Shadow Label

procedure ShadowLabel(oForm : TWinControl; const sText : String = 'Delphi'; iTop : Integer = 0; iLeft : Integer = 0; iDepth : Integer = 3; sFontName : String = 'Arail'; iFontSize : Integer = 10; const sLookingType : String = 'Raised');
var
oLabel1 : TLabel;
oLabel2 : TLabel;
begin
oLabel1 := TLabel.Create(oForm);
oLabel1.Parent := oForm;
oLabel1.Transparent := True;
oLabel1.Font.Name := sFontName;
oLabel1.Font.Size := iFontSize;
oLabel1.Caption := sText;
oLabel1.Font.Color := clWhite;

oLabel2 := TLabel.Create(oForm);
oLabel2.Parent := oForm;
oLabel2.Transparent := True;
oLabel2.Font.Name := sFontName;
oLabel2.Font.Size := iFontSize;
oLabel2.Caption := sText;
oLabel2.Font.Color := clBlack;

if sLookingType = 'Lowered' then begin
oLabel1.Top := iTop + iDepth;
oLabel1.Left := iLeft + iDepth;

oLabel2.Top := iTop; 
oLabel2.Left := iLeft;
oLabel2.BringToFront;
end;

if sLookingType = 'Raised' then begin
oLabel1.Top := iTop - iDepth;
oLabel1.Left := iLeft - iDepth;
oLabel1.BringToFront;

oLabel2.Top := iTop; 
oLabel2.Left := iLeft;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
ShadowLabel(TWinControl(self),'DelphiCode.ru',10,10,2,'Arial',28,'Lowered');
ShadowLabel(TWinControl(self),'DelphiCode.ru',60,10,2,'Arial',28,'Raised');
end;
    
21.06.2015 / 23:27