Hi, King Boy,
This is expected effect. What you use is not true transparency from the standpoint of Imaging used in
PictureBox
.
Instead, you need to use alpha channel (for example, using
System.Drawing.Imaging.PixelFormat
Format32bppArgb, Format32bppPArgb, Format64bppArgb or Format64bppPArgb
(
http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat.aspx[
^]). In particular, PNG format (default for .NET bitmaps) uses alpha channel.
Also, you did not explain the purpose of using the control
System.Windows.Forms.PictureBox
. This control is often heavily misused. It looks like you do the same when you drag and drop an image on a
PictureBox
. Even though you can do it, this control does not help you to implement desired behavior, only presents extra hassles and eat up resources with no purpose. If you need anything dynamic, or interactive, or animated, using a custom control with direct rendering using
OnPaint
is much better. I explained how to do it here:
How do I clear a panel from old drawing[
^].
—SA