Click to See Complete Forum and Search --> : How to create Non-rectangle window??
Prashant
Mar 15th, 2001, 05:54 PM
Hi,
Is there any API call, who help me to create Non-rect form. shall i create either circular or any other image shape's form using Win API?
Take a look at these two links.
http://www.vbsquare.com/tips/tip154.html
http://www.vb-world.net/articles/shapedforms/
Lord Orwell
Mar 16th, 2001, 12:02 AM
simple quick answer with no code sample:
use CreateEllipticalRgn or CreatePolygonalRgn api calls to make forms of any shape. Other api calls can xor the regions together to put holes in them, etc. When you have the rgn, use setwindowrgn to change your window shape.
I am thinking of making a window with a shape that changes every second just to test the extent of the ability.
KrishnaSantosh
Mar 16th, 2001, 10:57 PM
private declare function CreateEllipticRgn Lib "Gdi32" _
(byval x1 as long,byval y1 as long,byval x2 as _
long,byval y2 as long) As long
private declare function SetWindowRgn Lib "User32" _
(byval hWnd As Long,byval hRgn As Long,byval _
bRedraw As Boolean) As Long
private sub form_load()
Dim hRgn As Long
hRgn = CreateEllipticRgn(0,0,me.Width/Screen.TwipsPerPixelX,me.Height/Screen.TwipsPerPixelY)
SetWindowRgn Me.hWnd,hRgn
End Sub
'Please EMail Me Incase Of Problems.
gwdash
Mar 17th, 2001, 10:05 AM
i have created a window that looks like a remote. the easies way i have found is to put shape controls on your form where you want the borders, then, scaling the twips to pixels, you can get the exact measurements. Create the regions as you see fit (using given code or any of the other region functions). Then join them together using a function. then delete the shapes and walla!
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.