为什么我的 TSplitter 位于错误的位置?

发布于 2024-10-21 16:00:16 字数 870 浏览 11 评论 0原文

我有一个对话框,布局如下:

---------------------------------------------
|                                           |
| CONFIG AREA                               |
| Align: alTop                              |
--------------------------------------------- <-static boundary
|                                           |
| DISPLAY AREA 1                            |
| Align: alTop                              |
============================================= <-TSplitter Align: alTop
|                                           |
| DISPLAY AREA 2                            |
| align: alClient                           |
--------------------------------------------- <-bottom of dialog

但是,在运行时,拆分器不会显示在显示区域 1 和显示区域 2 之间,而是显示在配置区域和显示区域 1 之间,从而导致一些烦人的界面问题。表单的设置相关事件处理程序中没有任何内容可以更改任何这些组件的 Visible 或 Align 属性。有谁知道为什么拆分器没有加载到它在表单设计器中的位置?

I've got a dialog that's laid out something like this:

---------------------------------------------
|                                           |
| CONFIG AREA                               |
| Align: alTop                              |
--------------------------------------------- <-static boundary
|                                           |
| DISPLAY AREA 1                            |
| Align: alTop                              |
============================================= <-TSplitter Align: alTop
|                                           |
| DISPLAY AREA 2                            |
| align: alClient                           |
--------------------------------------------- <-bottom of dialog

However, at runtime, the splitter doesn't show up between Display Area 1 and Display Area 2, but between Config Area and Display Area 1, leading to some annoying interface problems. There's nothing in the form's setup-related event handlers that alters the Visible or Align properties of any of these components. Does anyone know why the splitter isn't loading in the place it's positioned at in the form designer?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

无所谓啦 2024-10-28 16:00:16

(无法重现。)分离器是很棘手的东西。我总是编写代码来定位它们。在这种情况下,我会做

procedure Form1Show(Sender: TObject);
begin
  Splitter1.Top := DisplayArea2.Top;
end;

(Can't reproduce.) Splitters are tricky things. I always write code to position them. In this case, I would do

procedure Form1Show(Sender: TObject);
begin
  Splitter1.Top := DisplayArea2.Top;
end;
紫竹語嫣☆ 2024-10-28 16:00:16

我过去也遇到过类似的问题。它们是由以下原因引起的:

  1. 那些看不见的控制。
  2. 控制创建顺序。

我认为分割器是在配置区域之后和显示区域1之前创建的。如果你在显示区域 1 之后创建它应该没问题。

I have had similar problems in the past. They were cause by:

  1. controls that where made invisible.
  2. control creation order.

I think the splitter is created after config area and before display area1. If you create it after display area 1 it should be fine.

天赋异禀 2024-10-28 16:00:16

我过去也遇到过同样的问题。 TSplitter 应放置在两个 TPanel 之间,如下所示:

+---------------------------------------------+
|+-------------------------------------------+|
||                                           ||
|| CONFIG AREA                               ||
|| Align: alTop                              ||
|+-------------------------------------------+|
||                                           ||
|| DISPLAY AREA 1                            ||
|| Align: alClient                           ||
|+-------------------------------------------+|
+---------------------------------------------+
=============================================== <-TSplitter Align: alTop
|                                             |
| DISPLAY AREA 2                              |
| align: alClient                             |
----------------------------------------------- <-bottom of dialog

配置区域和显示区域 1 现在应包含在具有 Align := alTop 的 TPanel 内,并且配置区域或显示区域 1 应与 alClient 对齐。

希望这有帮助

I also had the same problem in the past. TSplitter should be placed between two TPanel, like such:

+---------------------------------------------+
|+-------------------------------------------+|
||                                           ||
|| CONFIG AREA                               ||
|| Align: alTop                              ||
|+-------------------------------------------+|
||                                           ||
|| DISPLAY AREA 1                            ||
|| Align: alClient                           ||
|+-------------------------------------------+|
+---------------------------------------------+
=============================================== <-TSplitter Align: alTop
|                                             |
| DISPLAY AREA 2                              |
| align: alClient                             |
----------------------------------------------- <-bottom of dialog

Config Area and Display Area 1 should now be contained inside a TPanel with Align := alTop and either the Config Area or the Display Area 1 should be aligned to alClient.

Hope this helps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文