By default, our paint functions do not take the alpha channel into consideration. This is different from some programs, such as the Microsoft viewer, but similar to some other programs such Microsoft Paint.
If you want to change the behavior, you can do it in more than one way:
1. You could use the GDI+ paint engine. To do that, use RasterPaintProperties.PaintEngine = RasterPaintEngine.GdiPlus (Preferences => Print using GDI+ menu);
I tested using this code and it worked:
RasterCodecs.Startup();
RasterCodecs codecs = new RasterCodecs();
RasterImage rasterImage = codecs.Load(@"With Alpha No Transparent.png", 32, CodecsLoadByteOrder.Bgr, 1, 1);
RasterPaintProperties paintProperties = RasterPaintProperties.Default;
paintProperties.PaintEngine = RasterPaintEngine.GdiPlus;
paintProperties.RasterOperation = RasterPaintProperties.SourceCopy;
Graphics graphics = pictureBox1.CreateGraphics();
int width = rasterImage.Width;
int height = rasterImage.Height;
Rectangle rectangle = new Rectangle(0, 0, width, height);
rasterImage.Paint(graphics, rectangle, paintProperties);
2. If you want to paint a background image in the transparent parts of the image, you can combine the main image with the background image with the alpha channel as a mixing mask using the FeatherAlphaBlendCommand Class.