Where to find the default Winforms icon in Windows?

后端 未结 4 1394
逝去的感伤
逝去的感伤 2020-12-19 22:30

I assume this is a shared resource somewhere in Windows. Rather than making a copy for each app, is there a way to use this icon just like all Winforms apps use it?

4条回答
  •  一生所求
    2020-12-19 22:33

    You can just use the Save method:

    C#:

    string IcoFilename = "C:\\Junk\\Default.ico";
    using (System.IO.FileStream fs = new System.IO.FileStream(IcoFilename, System.IO.FileMode.Create))
    {
      this.Icon.Save(fs);
    }
    

    Visual Basic:

    Dim strFilename As String = "C:\Junk\Default.ico"
    Using fs As New System.IO.FileStream(strFilename, IO.FileMode.Create)
      Me.Icon.Save(fs)
    End Using
    

提交回复
热议问题