简体   繁体   English

使用 delphi 将面板停靠在框架中

[英]docking a panel in a frame using delphi

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.我查看了 devexpress 对接控件,但它们仅适用于 forms。

So I think I need to work out 2 issues.所以我认为我需要解决2个问题。

  1. how to make the panel movable and resizable.如何使面板可移动和调整大小。
  2. how to add docking logic to a frame?如何将对接逻辑添加到框架?

any help will be appreciated.任何帮助将不胜感激。

1) TPanel movable and resizable 1) TPanel 可移动和可调整大小

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.要使其可拖动,您需要使用 MouseDown、MouseMove、MouseUp 事件,检测并处理所需的鼠标使用来拖动。

You can even move the TPanel from its container to another container by changing its Parent property.您甚至可以通过更改其 Parent 属性将 TPanel 从其容器移动到另一个容器。 For example, you can move a panel from a TForm to another TForm.例如,您可以将面板从 TForm 移动到另一个 TForm。 That's what you'll use for making your panel floating.这就是您将用于使面板浮动的内容。

2) Floating TFrame 2)浮动TFrame

You cannot use a TFrame as a floating form.您不能将 TFrame 用作浮动表单。 You need a TForm for that.为此,您需要一个 TForm。

Note that you can use a TForm much like a TFrame.请注意,您可以像使用 TFrame 一样使用 TForm。 Use CreateParented to create the form and attach it to a container like a TFrame.使用 CreateParented 创建表单并将其附加到 TFrame 等容器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM