transparent png using wpf in VS2008

旧时模样 提交于 2019-12-24 00:47:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!