Label с эффектом тени в Delphi
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 |
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; |