问题
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.
Also how can I get this done in C#, without using WPF.
Thanks.
回答1:
You should just have to use the Image control and WPF should take care of the rest:
<Image Source="myimage.png" />
Or in pure C#:
BitmapImage sourceImage = new BitmapImage();
sourceImage.BeginInit();
sourceImage.UriSource = new Uri("myimage.png", UriKind.RelativeOrAbsolute);
sourceImage.EndInit();
Image myImage = new Image();
myImage.Source = sourceImage;
来源:https://stackoverflow.com/questions/1608417/transparent-png-using-wpf-in-vs2008