D 表单库 TableLayoutPanel?

发布于 2024-11-19 08:21:49 字数 308 浏览 2 评论 0原文

每次我尝试使用 D Forms Library 时,我都会遇到这样一个事实:它没有TableLayoutPanel——这使得我几乎不可能制作出一个好的 GUI。

有没有 DFL 的 TableLayoutPanel 实现?
如果没有它,人们通常如何使用这个库?

编辑:

指向另一个使用 DFL 的程序的链接对于答案来说将是一个巨大的奖励。 :)

Every time I try to use the D Forms Library, I run across the fact that it has no TableLayoutPanel -- which makes it practically impossible for me to make a good GUI.

Is there any TableLayoutPanel implementation out there for DFL?
How do people usually use this library without it?

Edit:

A link to another program that uses DFL would be a great bonus for an answer. :)

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

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

发布评论

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

评论(3

千寻… 2024-11-26 08:21:49

由于长度超过评论长度限制,因此发布为答案。

我否决了你的问题,因为它是用火焰诱饵的元素来制定的。我猜想您之前使用 GUI 库的经验主要是支持框布局的库,例如 Qt。 Win32 GUI API 本身不提供任何用于创建框布局的原语 - 它始终使用绝对坐标。这在许多构建于 API 之上的 OO 库(例如 MFC)中保持不变。一些库(例如 VCL)具有用于创建框布局(具有对齐和自动调整大小的面板)的可选原语 - 但最终,所有控件重新定位都必须由应用程序或 GUI 框架完成,因此需要像这样的东西从头开始在 DFL 中实现。

所以,回答你的问题:

是否有 DFL 的 TableLayoutPanel 实现?

可能不会。

如果没有它,人们通常如何使用这个库?

他们使用 Entice Designer 用鼠标在窗体上绘制控件。 (MFC/Visual Studio、VCL/Delphi IDE等也是如此)


回复评论:

如何将内容放入表格布局中(例如两个并排,一个在下面)?

我了解您希望在底部有一个固定高度的面板,并将剩余空间分成两个区域,当调整表单大小时,这两个区域都保持表单宽度的一半。

  1. 在 Entice Designer 中,放置一个面板,将其 dock 设置为 BOTTOM。适当设置其高度。
  2. 放置第二个面板,将其dock设置为RIGHT
  3. 在表单的代码中,添加以下方法:
    protected override void onResize(EventArgs ea)
    {
        super.onResize(ea);
        panel2.width = this.clientRectangle.width / 2;
    }

正如您所看到的,获得更复杂的“橡胶表”很快就会变得混乱。我不会打扰,或者如果我真的需要复杂的动态布局,会寻找另一个库。

或者您一开始就说这是一个坏主意?

绝对不是我的观点 - 不需要使用 IDE 构建的语义布局的优点是显而易见的。只是由于其 Win32 API 根源,Windows GUI 库很少提供构建它们的良好方法。当’不是。)

Posting as an answer because length exceeds comment length limit.

I downvoted your question because it is formulated with elements of flamebait. I would guess that your previous experience with GUI libraries was mostly with libraries supporting box layouts, such as Qt. The Win32 GUI API itself does not provide any primitives for creating box layouts - it uses absolute coordinates through and through. This remains unchanged in many OO libraries that build on top of the API, such as MFC. Some libraries, like VCL, have optional primitives for creating box layouts (panels with alignment and auto-size) - but in the end, all control repositioning has to be done by the application or the GUI framework, so something like this would need to be implemented in DFL from scratch.

So, to answer your questions:

Is there any TableLayoutPanel implementation out there for DFL?

Probably not.

How do people usually use this library without it?

They draw the controls on the form with a mouse, using Entice Designer. (The same is true for MFC/Visual Studio, VCL/Delphi IDE, etc.)


Reply to comment:

how do I put things in a table layout (e.g. two side-by-side, and one below)?

I understand that you'd like to have a fixed-height panel at the bottom, and split the remaining space into two areas which both remain half the form's width when the form is resized.

  1. In Entice Designer, place a Panel, set its dock to BOTTOM. Set its height appropriately.
  2. Place a second panel, set its dock to RIGHT.
  3. In your form's code, add the following method:
    protected override void onResize(EventArgs ea)
    {
        super.onResize(ea);
        panel2.width = this.clientRectangle.width / 2;
    }

As you can see, it can quickly get messy to get a more complicated "rubber table". I wouldn't bother, or if I really needed complex dynamic layouts, would look for another library.

Or are you saying that's a bad idea in the first place?

Definitely not my point - the advantages of semantic layouts that don't require using an IDE to build are clearly visible. It's just that due to their Win32 API roots, Windows GUI libraries rarely provide good means to build them. Of course, their absence doesn't make building GUIs impossible or even hard - people simply usually go with fixed-size forms, etc. (This is clearly visible to end users switching from Windows to KDE - most KDE dialogs are resizable, while Windows' aren't.)

冰之心 2024-11-26 08:21:49

如果缺少表格布局,您可以使用位置和大小属性在板上放置东西(甚至可能实现您自己的表格布局),

您可以使用 吸引设计师制作 GUI 并在生成的源代码的基础上进一步构建

in lack of a table layout you can use the location and size properties to position stuff on the board (and maybe even implement your own table layout)

you can use the entice designer to make the gui and build further on the generated source

能怎样 2024-11-26 08:21:49

现在我已经接近我的代码了,有两种方法可以管理布局。正如棘轮所提到的,有绝对位置,也有对接。停靠会将项目放置在 5 个可能的位置。顶部、底部、左侧、右侧或中心(填充)。然后,您可以将一个面板放置在其中一个面板中,该面板本身可以包含停靠在其中的元素。您将停靠值分配给停靠属性

Entice Designer 是用 DFL 编写的。

Now that I'm near my code, there are two ways to manage layout. As mentioned by ratchet there is absolute positions and also docking. Docking places the item in 5 possible locations. The Top, Bottom, Left, Right, or Center (fill). You can then place a panel in one of these which can itself contain elements that are docked within it. You assign the docking value to the dock property.

Entice Designer is written with DFL.

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