Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New tip: Animated roll down form #83

Open
delphidabbler opened this issue Nov 19, 2022 · 0 comments
Open

New tip: Animated roll down form #83

delphidabbler opened this issue Nov 19, 2022 · 0 comments
Assignees
Labels
considering Considering or investigating the issue enhancement New feature or request

Comments

@delphidabbler
Copy link
Owner

delphidabbler commented Nov 19, 2022

Possible new tip from extra/Topelina Tips.odt


formRolling

Creating a roll up form (with animation).

Here's a handy piece of code that will create a roll-down and roll-up effect for a form object when
a user right-clicks its title bar:

type
   TForm1 = class(TForm)
   private
    fOldClientHeight: Integer;
    procedure WMNCRButtonDown(var Msg: TWMNCRButtonDown) ; message WM_NCRBUTTONDOWN;
   public
   end;

var
   Form1: TForm1;

implementation
{$R *.dfm}

procedure TForm1.WMNCRButtonDown(var Msg: TWMNCRButtonDown) ;
var
   h : integer;
begin
   if (Msg.HitTest = HTCAPTION) then
   begin
     if (ClientHeight = 0) then
     begin
       for h := 0 to fOldClientHeight do ClientHeight := h;
       Application.ProcessMessages;
     end
     else
     begin
       fOldClientHeight := ClientHeight;
       for h := fOldClientHeight downto 0 do ClientHeight := h;
       Application.ProcessMessages;
     end;
   end;
end;

Contributed by: topellina [email protected]

@delphidabbler delphidabbler self-assigned this Jun 18, 2023
@delphidabbler delphidabbler added enhancement New feature or request considering Considering or investigating the issue labels Jun 18, 2023
@delphidabbler delphidabbler moved this from Accepted to Considering in Delphi Tips Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
considering Considering or investigating the issue enhancement New feature or request
Projects
Status: Considering
Development

No branches or pull requests

1 participant