防止 Delphi 10.2 自动向 TForm 添加属性

Prevent Delphi 10.2 from auto adding properties to TForm

我有一个正在处理的代码库,它被编写为在 Delphi 5 和 Delphi 10.2 中工作,直到我们将所有内容都转换为 D10。

每当我在 10.2 中打开一个 DFM 文件并保存它时,它会自动在 TForm 中添加一个 DesignSize 属性。这个属性在D5中不存在,所以每次在D5中打开同一个DFM都会报错

有什么办法可以防止D10自动更新DFM吗?或者这是不可能的?

您可以在需要时使用实用程序清除它们。 JVCL 包含一个名为 DFM Cleaner 的实用程序来执行此操作。在安装 JVCL 后,最终位于 $(JVCL)\DevTools 中。

DFMCleaner is a tool to remove unsupported properties from DFMs. If you save a dfm file in one version of Delphi and want to use it in an earlier version, chances are there are some unsupported properties in it, generating an error when the form is opened in Delphi. What's even worse, if the dfm is part of a design-time package, Delphi will install the package without errors but when you try to access the form at design-time (f ex if the form is used by a property editor), Delphi generates an AV instead.