创建自定义表单设计器

发布于 2024-07-30 19:21:26 字数 148 浏览 2 评论 0原文

我想在 Delphi 中创建一个自定义的“数据模块”,一个类似 TDataModule 的(可能是继承的)类,它将具有一个基于自定义网格的设计界面(每行一个组件,一些属性作为列)。 这可能吗? 我应该从哪里开始?

我目前使用的是 Delphi 2007。

I'd like to create a custom "datamodule" in Delphi, a TDataModule like (maybe inherited) class which would have a custom grid based design interface (one component per line, some properties as columns). Is this possible? Where should I start?

I'm currently using Delphi 2007.

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

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

发布评论

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

评论(3

九命猫 2024-08-06 19:21:30

完全按照你的描述是不可能的。 您不能将可视化组件(例如网格)放置在数据模块上。 为此,您需要一个表格或框架。

如果我确实尝试像您所描述的那样,我会使用一个列表框来保存各个组件的列表,几个按钮和一个用于从列表中添加和删除组件的选择对话框,以及 TJvInspector 组件从 JVCL 修改属性。 这比尝试制作一个通用的网格来处理这种情况要容易得多。

It's not possible exactly as you describe it. You can't place visual components like a grid on a data module. You need a form or frame for that.

If I were to do try to something like you're describing, I'd use a list box to hold a list of individual components, a couple buttons and a selection dialog box for adding and deleting components from the list, and the TJvInspector component from the JVCL for modifying properties. That would be a lot easier than trying to make a one-size-fits-all grid to handle the situation.

小糖芽 2024-08-06 19:21:30

正如 Nick Hodges 在这里指出的那样:

在 Delphi 中的 DataModule 上绘图

它将是很难在 TDataModule 后代上绘制。 也许并非不可能,但肯定不值得这么麻烦。

我会考虑从头开始设计一个全新的 TDataModule,这样您就可以完全控制它。 当然,可能需要做很多工作,但最终会得到回报。

您可以在 Classes.pas 单元中找到 TDataModule 类。 但这只是代码的运行时部分。 其他部分与IDE相关。 例如,对于 BDS 2006,您可以在“c:\Program Files\Borland\BDS\4.0\source\ToolsAPI\”中找到与 ToolsAPI 相关的单元。 您还可以从 TDataModule 派生您自己的数据模块,并将其注册到 RegisterCustomModule (DesignIntf​​.pas)。 我对这个问题了解不多,也许其他人知道。 正如我所说,做这样的事情并不容易。 但也许有了这些初步信息,您就可以找到您想要的东西。

As Nick Hodges pointer out here:

Drawing on a DataModule in Delphi

it would be difficult to paint on the TDataModule descendant. Not impossible probably, but not worth the trouble for sure.

I would consider designing a completely new TDataModule from scratch, so you would have complete control over it. Sure a lot of work probably, but in the end it would pay off.

You can find TDataModule class in the Classes.pas unit. But this is just the runtime part of the code. Other parts are IDE related. You can find units related to ToolsAPI in "c:\Program Files\Borland\BDS\4.0\source\ToolsAPI\" for BDS 2006 for instance. You can also derive you own data module from TDataModule and register it with RegisterCustomModule (DesignIntf.pas). I don't know much more on this subject, maybe others do. As I said it would not be easy to do something like that. But maybe with this initial information you can find what you want.

_畞蕅 2024-08-06 19:21:29

也许有可能。 XML 框架设计器的示例可以在页面 New IDE Building 中找到块。 这个例子适用于 Delphi 5,但它可能是一个很好的起点。

Maybe it is possible. An example of a XML Frame Designer can be found on the page New IDE Building Blocks. Well this example is for Delphi 5, but it might be a good starting point.

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