阻止 C++Builder XE 删除/编辑 .dfm 文件中的 UI 组件

发布于 2024-11-28 04:38:26 字数 223 浏览 3 评论 0原文

如何阻止 C++Builder XE 自动编辑 .dfm 文件?

我目前正在将相当大的代码库从 BCB5 移植到 XE。许多外部组件已在旧代码中使用,但尚未为新环境安装(因为我需要找到工作替代品或自己移植它们)。现在,Builder 会删除/更改我的 dfm 文件中这些 UI 组件的定义。如果 IDE 没有找到该组件的实现,则会将其完全删除。对于已知的组件,尺寸会多次改变较小的值。我怎样才能改变这种烦人的行为呢?

How can I stop C++Builder XE from automatically editing .dfm files?

I'm currently porting a rather big code base from BCB5 to XE. A lot of external components have been used in the old code, but are not yet installed for the new environment (since I need to find working substitutes or port them myself). Now, the Builder removes/changes the definitions of these UI components in my dfm files. If the IDE does not find the implementation of the component, it is removed completely. For known components, the size is changed by a small value quite a lot of times. How can I turn of this annoying behavior?

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

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

发布评论

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

评论(2

墨小沫ゞ 2024-12-05 04:38:26

它将编辑 DFM 和头文件以删除组件。

共有三个选项:

  • 当 IDE 打开一个不存在组件的表单时,它会询问您要做什么。您可以单击“全部忽略”,它不会删除这些组件引用。

  • 如果您使用源代码管理,您应该能够恢复这些更改。即,让 IDE 做任何它想做的事情,然后恢复或不提交这些更改。

  • 最好的方法是实际安装这些组件。如果您在项目中打开表单但组件不存在,您想做什么?您将无法编译它们。如果您需要用不同的组件替换组件,那么 IDE 删除旧组件有什么问题吗?

    在自己升级项目及其文件之前,您可能应该首先尝试安装相同组件的较新版本。然后升级项目,并根据具体情况删除对不存在组件的引用,并用不同的组件替换它们。

“对于已知组件,大小会多次改变一个小值。”

从技术上讲,这是一个不同的问题;)但如果它很小,请忽略它。一些属性,例如 ExplicitLeftExplicitTop 几乎肯定会发生变化,我认为这是由于不同的窗口标题栏和边缘宽度(通常会在您使用时看到,例如,我想,当表单用 XP 保存时,我一直不太明白为什么这些会不断变化,但它似乎不会影响任何东西。)确保您使用的系统具有与系统相同的 DPI 设置。表格最后保存于,也是(这是“显示”属性中的字体大小设置。)

It will edit both the DFM and the header file to remove components.

There are three options:

  • When the IDE opens a form for which components don't exist, it will ask you what to do. You can click "Ignore All" and it won't remove those component references.

  • If you're using source control, you should be able to revert those changes. Ie, let the IDE do whatever it wants, and then revert or don't commit those changes.

  • The best approach though would be to actually have those components installed. If you're opening forms in the project but the components don't exist, what are you trying to do? You won't be able to compile them. And if you need to replace the components with different ones, what's wrong with the IDE removing the old ones?

    You should probably try to install newer versions of the same components where possible first, before upgrading the project and its files yourself. Then upgrade the project and on a case-by-case basis let it remove references to components that don't exist, and replace them with your different components.

"For known components, the size is changed by a small value quite a lot of times."

Technically this is a different question ;) But if it's small, ignore it. Some properties like ExplicitLeft and ExplicitTop will almost certainly change, and I think this is due to different window title bar and edge widths (usually seen if you're using, say, Vista when the form was saved with XP. I think. I've never quite figured out why these constantly change, but it doesn't seem to affect anything.) Make sure you are using a system with the same DPI setting as the one the forms were last saved on, too (this is the font size setting in your Display properties.)

青朷 2024-12-05 04:38:26

我发现只有相应的 cpp 或 h 文件打开时,dfm 文件才会被 IDE 更改。这样,我可以编译源代码,一旦发现未知的组件/属性,编译器就会抛出错误,我可以解决它们。

I found out that the dfm files are only changed by the IDE if the corresponding cpp or h file is open. This way, I can compile the source, the compiler will throw an error as soon as unknown components/properties are found and I can resolve them.

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