1 public partial class MainWindow : Window 2 { 3 public MainWindow() 4 { 5 InitializeComponent(); 6 7 AddOverlay.Click += new RoutedEventHandler(AddOverlay_Click); 8 OtherOverlay.Click += new RoutedEventHandler(OtherOverlay_Click); 9 } 10 11 void OtherOverlay_Click(object sender, RoutedEventArgs e) 12 { 13 // TaskbarItemInfo.Overlay,获取或设置在任务栏按钮中的程序图标上方显示的图像 14 //TaskbarItemInfo.Overlay = null; 15 TaskbarItemInfo.Overlay = (ImageSource)Resources["OverlayImageVector"]; 16 } 17 18 void AddOverlay_Click(object sender, RoutedEventArgs e) 19 { 20 TaskbarItemInfo.Overlay = (ImageSource)Resources["OverlayImage"]; 21 } 22 }