WPF:Window Icon

来源:互联网 发布:图像识别算法 编辑:程序博客网 时间:2024/05/20 06:08

http://msdn.microsoft.com/en-us/library/system.windows.window.icon.aspx

A WPF window always displays an icon. When one is not provided by setting Icon, WPF chooses an icon to display based on the following rules:

  1. Use the assembly icon, if specified.

  2. If the assembly icon is not specified, use the default Microsoft Windows icon.

 

 

可以使用程序集级别的icon,也可以自己指定

// Set an icon using codeUri iconUri = new Uri("pack://application:,,,/WPFIcon2.ico", UriKind.RelativeOrAbsolute);this.Icon = BitmapFrame.Create(iconUri);