Search code examples
formsdelphipanelvcleffect

How can I do This effect?


I'm Trying to do, in delphi, that when you press a button, I display a drop-down panel with options like this:

Panel Desplegable

Does anyone know how to make this effect with VCL? Now I have a form with 2 panels, the main is always showing and has a side button, and when I press the button the side panel is shown, but I would like to make the effect. Thank you


Solution

  • I dont know your application in detail, with the transparency and other things. However, I think you will have to animate your panels/windows in some sort of loop on your own. I dont know of any VCL function for that.

    Here is an example which animates a Window (its quick and dirty though):

    enter image description here

    Code:

    procedure TForm1.Button1Click(Sender: TObject);
    var
      I, X: Integer;
    begin
      Form2.Width := 1;
      Form2.Height := Form1.Height;
      Form2.Left := Form1.Left + Form1.Width;
      Form2.Top := Form1.Top;
      Form2.Show;
    
      Timer1.Enabled := true;
    end;
    
    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      if I < 500 then
      begin
        I := I + 1;
        Form2.Width := I;
      end
      else
      begin
        Timer1.Enabled := false;
      end;
    end;
    

    Not perfect, but hopefully good enough to give you an idea.

    Andy