C# Change the icon on the top left of winform

前端 未结 4 2011
梦如初夏
梦如初夏 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:50

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

        public MainForm()
        {
            InitializeComponent();
            Icon = Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetExecutingAssembly().Location);
        }
    

提交回复
热议问题