C# console application icon

前端 未结 3 1601
逝去的感伤
逝去的感伤 2020-11-29 10:27

Does anyone know how to set a C# console application\'s icon in the code (not using project properties in Visual Studio)?

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 10:54

    You can't specify an executable's icon in code - it's part of the binary file itself.

    From the command line you'd use /win32icon: if that's any help, but you can't specify it within the code of the application. Don't forget that most of the time the application's icon is displayed, your app isn't running at all!

    That's assuming you mean the icon for the file itself in explorer. If you mean the icon of the application while it's running if you just double-click the file, I believe that will always just be the icon for the console itself.

提交回复
热议问题