C# Change the icon on the top left of winform

前端 未结 4 2007
梦如初夏
梦如初夏 2020-12-31 02:16

I\'m trying to change the top left corner icon of the winform from the default one to my icon: \"enter

相关标签:
4条回答
  • 2020-12-31 02:33

    Make Sure that Photo you're choosing is .ico format then you can change simply change it in visual studio form properites.

    0 讨论(0)
  • 2020-12-31 02:34

    It's quite easy; just right-click your window in the visual studio designer and click on settings then navigate in the settings sidebar to the icon section - click on the three dots and select a .ico file as your icon to be displayed in the top left corner of you application.

    0 讨论(0)
  • 2020-12-31 02:36

    Your form has properties associated with it (in design mode, have the focus on your form and click F4). One of the properties is Icon and this is what you're looking for.

    The icon you are referring to, in Application Properties, is the icon that will be used in the .EXE generated file.

    0 讨论(0)
  • 2020-12-31 02:50

    You can use the icon setted for application using the following code:

        public MainForm()
        {
            InitializeComponent();
            Icon = Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetExecutingAssembly().Location);
        }
    
    0 讨论(0)
提交回复
热议问题