How to put shade on a "label" in Delphi?

Asked

Viewed 761 times

0

Hello, I was wondering how to put shadow on a "label" in Delphi like this image below:inserir a descrição da imagem aqui

1 answer

1


Dude, I believe this is only with third-party components, but I’ve got an example with shadow but not this one that 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;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.