Question

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

Was it helpful?

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

OTHER TIPS

you can use TJvRollOut from Jedi JVCL. It acts like a panel which colapse and expand. Also you can take a look at Delphi: sliding (animated) panel and Hide, Slide And Fade Away Controls On A Delphi Form

Finally, I managed to make the effect. I put a panel and I have added a picture. then I used animatedwindows in buton click process.

procedure TFTelefonoSIP.Button1Click(Sender: TObject);
begin
  if  GDPanelLlamadasHidden = False then
  begin
    AnimateWindow(Panel1.Handle, 200, AW_SLIDE or AW_HOR_POSITIVE or AW_HIDE);
    GDPanelLlamadasHidden := True;
  end
  else
  begin
    AnimateWindow(Panel1.Handle, 200, AW_SLIDE or AW_HOR_NEGATIVE or AW_ACTIVATE);
    GDPanelLlamadasHidden := False;
  end;
end;

But the effect is not quite what I wanted, sometimes the image shows a flash, not very aesthetic.

enter image description here

you should enable the "Double Buffered" property at the application form's... this should prevent the flashing..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top