This is a port of my other article from C++/MFC to C#/Windows Forms. The concept of creating a per-pixel-alpha blending window remains the same, the GDI function
- Image loading is handled by GDI+ classes (
- No need to pre-multiply the rgb channels with the alpha channel.
- No more support for PSP files. PNG file are the best choice.
To use this code you need to include PerPixelAlphaForm.cs file in your project, create a class that inherits from
PerPixelAlphaForm, load a bitmap using
System.DrawingImage.FromFile static method and then call the
The example source code is inside the main.cs file. In the source code you will also find the new ways of doing the old things, like, handling dropped files from windows explorer.
Installing & Building
- Download and extract the source code of this article;
- To build, run the build.bat file from command prompt;
- Now, run the bin\main.exe and enjoy!
31 May 2004
- Fix clipping problems by creating the form without borders.
PerPixelAlphaForm class to PerPixelAlphaForm.cs file.
12 Feb 2002
Do you have any question or comment? Contact me!