Any code for windows as well ? thanks .
Look into examples/Platform Specific/Windows/CustomWindowShape
Well thanks but it does not really works properly, the image looks like a monitor from '80 and it`s like 8 colors not full image then the whole image gets shifted some how , i have no idea why
I used same code there
Strange. I use the very same underlying methods, and no such issues. You may want to verify the quality of your pictures.
At any rate, I am afraid this is the only game in town…
I really wonder, what are the use cases for a custom shaped window?
I used setWindowMaskMBS for a Windows app (in this case just to have nicely rounded corners) and its looking absolutely fine:
(in Window.open)
#If TargetWin32
Dim p As Picture
p = New Picture (Width*ScaleFactor, Height*ScaleFactor,32)
p.Graphics.ForeColor=RGB(0,0,0)
p.Graphics.FillRoundRect 15*ScaleFactor,15*ScaleFactor,461*ScaleFactor, 461*ScaleFactor, 20, 20
If Not Self.SetWindowMaskMBS(p,True, RGB(255,255,255)) Then
Break
End If
#EndIf
A FillOval brings a round window like requested in the initial question.
Like the OP said: Its a nice feature for a splash screen.
[quote=362980:@Ulrich Bogun] Dim p As Picture
p = New Picture (WidthScaleFactor, HeightScaleFactor,32)
p.Graphics.ForeColor=RGB(0,0,0)
p.Graphics.FillRoundRect 15ScaleFactor,15ScaleFactor,461ScaleFactor, 461ScaleFactor, 20, 20
If Not Self.SetWindowMaskMBS(p,True, RGB(255,255,255)) Then
Break
End If[/quote]
I Used it on Window OPEN event, and unfortunately It doesn’t work for me
So It does the Window Mask, but shows me the gray
Window of the App
You mean you want the visible rest of the window to have some transparency too?
Call Me.MakeTransparentMBS
Me.transparencymbs = 0.5
Or did I get you wrong?
Some developers use them for showing a custom splash screen logo (blizzard), some use them for custom window shapes if they have something hanging off their main window and dont want to take up space with a rectangular design.
Here’s an example I did back in November if it helps:
MBS Plugin comes with examples.
You need to enable transparency and than draw with alpha channel in paint event.
(For Mac at least)
and check MBS Xojo Overlay Plugin for the OverlayMBS class.
Julian: thanks.
The image is missing.
[quote=363142:@Emile Schwarz]Julian: thanks.
The image is missing.[/quote]
Sorry that isn’t needed, I just based it on the example file that was in the the “Xojo\Example Projects\Platform-Specific\Windows\CustomWindowShape” folder and forgot to comment out all the redundant code. I’ve tweaked the save file if you want to download it again.
Windows only btw.
Thanks.