Canvas transparency - Windows

I have a picture in a Canvas with a round mask applied. Canvas’ transparency is True. Code to create a round picture (works perfectly on the plain Window):

Public Function DrawCircleWithPicture(MyPicture as Picture) as Picture
  Dim p As New picture(MyPicture.Width,MyPicture.Height,32)
  Dim p2 As New Picture(MyPicture.Width,MyPicture.Height,32)
  p2.Graphics.ForeColor = RGB(255,255,255)
  p2.Graphics.FillRect(0,0,MyPicture.Width,MyPicture.Height) = RGB(0,0,0)
  p2.Graphics.PenWidth = 4
  return p
End Function

But when I place this on another Canvas, there is no transparency:

2020-12-02 11_51_58-Window

How to do this?

Try this:

Dim p As New picture(MyPicture.Width,MyPicture.Height)

Constructor for your pictures without the bits depth

Thanks but alas, same result

Do paint without a mask and set alpha for the color

Well the mask takes care of clipping the square pic into a circle. Strange thing is that at design time it behaves ok, showing the background when Transparency = True.

Past 2017R2, Xojo Windows canvas, labels and other usually transparent controls started using “pseudo transparency”, when the control takes the color of the parent.

Compared to Mac, it is utterly messy.

Personally, I develop Windows under 2016R3, which is the last bug free version with true transparency, identical to what I see in Mac.

Well, I found out that if I change the parent of the canvas to the underlying control the transparency reappears…

Except it is pseudo transparency. It looks transparent if you don’t have anything else under the canvas.

The only way to get true transparency for Windows in recent Xojo would be to grab the picture of what lays underneath, and display it. Much more involved than using a prior version as I do which provides true transparency.

In fact, in my best seller app, I use for instance containercontrol based custom ccntrols which rely on transparency. If I was to port this to a more recent version, I would need to completely refactor the entire UI.