Note that there are some explanatory texts on larger screens.

plurals
  1. POWinforms semi-transparent PNG over semi-transparent PNG
    text
    copied!<p>I think I must be missing something obvious, but I'm unable to find this after several hours of searching. Is there no way to use a PictureBox or other control to contain an image with partial transparent/alpha-blended pixels, and place that over another image and have the blending be based on the image under it?</p> <p>For example, this produces the results I want:</p> <ol> <li>Place a panel on a form.</li> <li>Add an OnPaint handler.</li> <li>In the OnPaint handler draw 1 PNG, then draw another PNG over it, using Graphics.DrawImage for both.</li> </ol> <p>This does not:</p> <ol> <li><p>Place a PictureBox on a form and set it to a PNG.</p></li> <li><p>Place another PictureBox on the form and set it to a PNG.</p></li> <li><p>Place the 2nd picture box over the first.</p></li> </ol> <p>...even if the 2nd picture box is just empty and has a background color of Transparent, it still covers the picture below it.</p> <p>I've read this stems from all winform controls being windows, so by nature they aren't transparent.</p> <p>...but even the 15 year old platform I'm migrating from, Borland's VCL, had several windowless controls, so it's hard to imaging winforms doesn't at least have some easy solution?</p> <p>My first example above is one answer, true, but that adds a lot of work when you can only use one big panel and draw all of your "controls" inside of it. Much nicer if you can have separate controls with separate mouse events/etc. Even if not an image control, and a control I have to draw myself, that would be fine, as long as I can just put one image in each control. In VCL they called this a "paint box", just a rectangle area you could place on a form and draw whatever you want on it. Has it's own mouse events, Bounds, etc. If you don't draw anything in it, it is like it's not even there (100% transparent) other than the fact it still gets mouse events, so can be used as a "hot spot" or "target" as well.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload