From de8719ff46e6777e9fd144f449b4d3a7add240c5 Mon Sep 17 00:00:00 2001 From: wp Date: Thu, 29 Nov 2018 21:52:01 +0000 Subject: [PATCH] IDE: Anti-aliased painting of the About form logo image. git-svn-id: trunk@59697 - --- ide/aboutfrm.lfm | 5 ++--- ide/aboutfrm.pas | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/ide/aboutfrm.lfm b/ide/aboutfrm.lfm index 148d4dab8a..4325d7db3d 100644 --- a/ide/aboutfrm.lfm +++ b/ide/aboutfrm.lfm @@ -10,6 +10,7 @@ object AboutForm: TAboutForm ClientWidth = 460 OnClose = FormClose OnCreate = AboutFormCreate + OnShow = FormShow PopupMenu = PopupMenu1 Position = poScreenCenter ShowHint = True @@ -37,8 +38,6 @@ object AboutForm: TAboutForm Height = 300 Top = -1 Width = 450 - Proportional = True - Stretch = True end object VersionLabel: TLabel AnchorSideLeft.Control = LogoImage @@ -191,12 +190,12 @@ object AboutForm: TAboutForm AnchorSideRight.Control = AboutPage AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = OfficialLabel - BorderSpacing.Around = 6 Left = 0 Height = 253 Top = 0 Width = 458 Anchors = [akTop, akLeft, akRight, akBottom] + BorderSpacing.Around = 6 ReadOnly = True ScrollBars = ssAutoBoth TabOrder = 0 diff --git a/ide/aboutfrm.pas b/ide/aboutfrm.pas index cdb22d9709..e2a6e53d81 100644 --- a/ide/aboutfrm.pas +++ b/ide/aboutfrm.pas @@ -97,6 +97,7 @@ type procedure AboutFormCreate(Sender:TObject); procedure CopyToClipboardButtonClick(Sender: TObject); procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction); + procedure FormShow(Sender: TObject); procedure miVerToClipboardClick(Sender: TObject); procedure NotebookPageChanged(Sender: TObject); procedure URLLabelMouseDown(Sender: TObject; {%H-}Button: TMouseButton; @@ -108,6 +109,7 @@ type Contributors: TScrollingText; procedure LoadContributors; procedure LoadAcknowledgements; + procedure LoadLogo; public end; @@ -124,7 +126,7 @@ implementation {$R *.lfm} uses - IDEImagesIntf; + GraphUtil, IDEImagesIntf; function ShowAboutForm: TModalResult; var @@ -172,7 +174,6 @@ const begin Notebook.PageIndex:=0; - LogoImage.Picture.LoadFromResourceName(HInstance, 'splash_logo', TPortableNetworkGraphic); Caption:=lisAboutLazarus; VersionLabel.Caption := lisVersion+' #: '+ GetLazarusVersionString; RevisionLabel.Caption := lisSVNRevision+LazarusRevisionStr; @@ -191,10 +192,10 @@ begin VersionLabel.Font.Color:= clWhite; - Constraints.MinWidth:= 460; - Constraints.MinHeight:= 380; - Width:= 460; - Height:= 380; + Width:= Scale96ToForm(460); + Height:= Scale96ToForm(380); + Constraints.MinWidth:= Width; + Constraints.MinHeight:= Height; AboutMemo.Lines.Text:= Format(lisAboutLazarusMsg,[DoubleLineEnding,DoubleLineEnding,DoubleLineEnding]); @@ -225,6 +226,11 @@ begin Contributors.Active := False; end; +procedure TAboutForm.FormShow(Sender: TObject); +begin + LoadLogo; +end; + procedure TAboutForm.miVerToClipboardClick(Sender: TObject); begin Clipboard.AsText := 'Lazarus ' + LazarusVersionStr + ' r' + LazarusRevisionStr + @@ -300,6 +306,24 @@ begin Acknowledgements.Lines.Text:=lisAboutNoContributors; end; +procedure TAboutForm.LoadLogo; +var + pic: TPicture; + W, H: Integer; +begin + pic := TPicture.Create; + try + pic.LoadFromResourceName(hInstance, 'splash_logo', TPortableNetworkGraphic); + W := LogoImage.Width; + H := LogoImage.Height; + LogoImage.Picture.Bitmap.SetSize(W, H); + AntiAliasedStretchDrawBitmap(pic.Bitmap, LogoImage.Picture.Bitmap, W, H); + finally + pic.Free; + end; +end; + + { TScrollingText } procedure TScrollingText.SetActive(const AValue: boolean);