docking a panel in a frame using delphi

627 Views Asked by At

I have an application made with frames. I have a panel on the frame that I need to work out how to float and dock. I'm not sure how to accomplish this. I looked at devexpress docking controls, but they only work with forms.

So I think I need to work out 2 issues.

  1. how to make the panel movable and resizable.
  2. how to add docking logic to a frame?

any help will be appreciated.

1

There are 1 best solutions below

2
fpiette On

1) TPanel movable and resizable

A Panel is always movable inside its container (Form, frame, another panel, scrollbox,...) and resizable. You just have to change its Top, Left, width and height properties. To make it dragable, you need to use MouseDown, MouseMove, MouseUp event, detect and handle the required mouse use to drag.

You can even move the TPanel from its container to another container by changing its Parent property. For example, you can move a panel from a TForm to another TForm. That's what you'll use for making your panel floating.

2) Floating TFrame

You cannot use a TFrame as a floating form. You need a TForm for that.

Note that you can use a TForm much like a TFrame. Use CreateParented to create the form and attach it to a container like a TFrame.