更改 Delphi 控制台应用程序的图标
如何更改 Delphi 控制台应用程序的程序图标?
应用程序设置在控制台应用程序中呈灰色。
再见。
How do I change the program icon for a Delphi console application?
The application settings is greyed in a console application.
Bye.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
根据 2007 年 7 月的博客文章Nibu Thomas 提出,似乎有一个
SetConsoleIcon
WinAPI 函数。或者,只需将图标放入资源文件中即可。 Windows 应使用在应用程序资源中遇到的第一个图标作为应用程序图标。
According to a July 2007 blog article by Nibu Thomas, there seems to be a
SetConsoleIcon
WinAPI function.Alternatively just put the icon in a resource file. Windows should use the first icon it encounters in the application's resources as the application icon.
如果更改图标的选项被禁用,那么这是因为您已删除或忽略从 DPR 文件中添加以下行:
将其放回去,如果您从未有过,则添加它。图标设置将重新启用,版本信息设置也将重新启用。如果资源文件不存在,IDE 会为您创建它。不要编辑该资源文件(例如添加您自己的图标或其他资源);它仅供 IDE 使用。
If the option to change the icon is disabled, then it is because you have deleted or neglected to add the following line from your DPR file:
Put it back, or add it if you never had it. The icon setting will be re-enabled, as will the version-information settings. If the resource file does not exist, then the IDE will create it for you. Do not edit that resource file (such as to add your own icons or other resources); it is for the IDE's use only.
如果您
在 dpr 文件中添加某个位置,您可以使用项目->选项来更改图标。
更改图标后,只需删除“application.Run;”再次,您可以使用新图标进行编译/构建。
if you add
somewhere in your dpr file you can use the project->options to change the icon.
After you have changed the icon just remove "application.Run;" again and you can compile/build with new icon.
只需更改应用程序资源文件中的图标(假设您的应用程序项目名为 ConsoleApp.dpr,您的应用程序资源文件将为 ConsoleApp.res)。
其中的主图标资源直观地称为 MAINICON,只需替换它即可。
这是 C++ Builder 的分步(步骤与德尔福)
Simply change the Icon in your apps resource file (say your app project is called ConsoleApp.dpr, your app resource file will be ConsoleApp.res)
The main icon resource in there is intuatively called MAINICON, just replace it.
Here is a step by step for C++ Builder (the steps are basically the same in Delphi)
{$APPTYPE CONSOLE} 行的注释使用 Delphi XE 进行测试
Tested with Delphi XE