如何将图标设置为红色程序中的视图?

How do I set an icon to a view in red program?

我想给主程序设置一个图标window。我发现这个页面 https://www.red-lang.org/2016/03/060-red-gui-system.html 上面写着:

Icons and other "resources" are now supported for inclusion in Windows executables. They can be set from Red's main script header, these are the currently supported options:

Icon: file! or block! of files

If no Icon option is specified, a default Red icon will be provided.

我不知道我是否需要在程序声明或其他地方这样做

Red [
    needs view
    icon %icon1.ico
]
; this doesn't seem to work but it also doesn't break the program

我也试过将 icon 行放在定义视图的块中,但它破坏了程序。

正确的语法是:

Red [
    needs: view
    icon: %icon1.ico
]

还需要编译程序(例如red -c -t windows program.red)。如果程序作为脚本启动(do %program.red 在红色控制台应用程序中)图标将不会被拾取。