private void Form1_Load(object sender, EventArgs e)
{
// Create a Bitmap object from an image file.
Bitmap myBitmap = new Bitmap(@"D:\hongse.jpg");
// Get an Hicon for myBitmap.
IntPtr Hicon = myBitmap.GetHicon();
// Create a new icon from the handle.
Icon newIcon = Icon.FromHandle(Hicon);
// Set the form Icon attribute to the new icon.
this.Icon = newIcon;
}
C#使用位图作为窗口图标icon
最新推荐文章于 2024-07-04 10:03:43 发布