What pixel format is your bitmap? If it does not have an alpha channel, you cannot store transparency information in your image.
Here's how to create a bitmap with an alpha channel and make it transparent by default:
Bitmap image = new Bitmap(width, height, PixelFormat.Format32bppArgb); using(Graphics graphics = Graphics.FromImage(image)) { graphics.Clear(Color.Transparent);
Then you can draw whatever you want, including translucent things, using the alpha channel.
Also note that if you are trying to draw transparency over an existing opaque material (say, to make a hole), you need to change the layout mode:
graphics.CompositingMode = CompositingMode.SourceCopy;
This will make any color that you use to rewrite it in the image, not mix with it.
source share