Haim Bender
Haim Bender

Reputation: 8187

transparent png using wpf in VS2008

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.

Upvotes: 2

Views: 2573

Answers (1)

Drew Marsh
Drew Marsh

Reputation: 33379

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;

Upvotes: 4

Related Questions