Results 1 to 5 of 5

Thread: How to create Non-rectangle window??

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Location
    San Jose
    Posts
    26

    Question

    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?

  2. #2

  3. #3
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    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.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  4. #4
    Addicted Member KrishnaSantosh's Avatar
    Join Date
    Feb 2001
    Location
    Coimbatore
    Posts
    210
    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.

  5. #5
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    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!
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width