VS2008中使用WPF的透明png [英] transparent png using wpf in VS2008
本文介绍了VS2008中使用WPF的透明png的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使UI在WPF VS2008中是半透明的,所以我使窗体透明,并且要在其顶部显示半透明png(其中包括孔"). 如何显示半透明的png?
I want make a UI that is semi transparent in WPF VS2008, so I made my form transparent and I want to show a semi transparent png (Which includes "holes") on top of it. How do I show the semi transparent png?
半透明,这意味着您可以看到孔.
Semi transparent, meaning it has holes you can see through.
此外,如何在不使用WPF的情况下用C#完成这项工作.
Also how can I get this done in C#, without using WPF.
谢谢.
推荐答案
您应该只需要使用Image控件,而WPF应该处理其余的事情:
You should just have to use the Image control and WPF should take care of the rest:
<Image Source="myimage.png" />
或使用纯C#:
BitmapImage sourceImage = new BitmapImage();
sourceImage.BeginInit();
sourceImage.UriSource = new Uri("myimage.png", UriKind.RelativeOrAbsolute);
sourceImage.EndInit();
Image myImage = new Image();
myImage.Source = sourceImage;
这篇关于VS2008中使用WPF的透明png的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文