代码编辑器中的这句{$R *.dfm}是什么意思?

What this phrase {$R *.dfm} in the code editor?

代码编辑器中的{$R *.dfm}这个短语是什么意思?

我试过这个:

//{$R *.dfm}

你会想把它放在那里。 $R 指令将资源文件链接到 EXE。 *.dfm 表示 "the file that has the same filename as this .pas file, but with a .dfm extension instead."

它的作用是确保当编译器构建项目时,您的表单数据最终会被编译进去。否则,当您的代码尝试加载表单时,它将无法找到表单数据,它会崩溃。