Jump to content

Only round top corners


willichan
 Share

Go to solution Solved by ahmet,

Recommended Posts

I don't know why he wants it, but I had someone ask me if I could modify a script I did for him to have the top corners rounded, but not the bottom.  I have seen a few code examples for making all of the corners of a GUI rounded, but, not for just rounding specified corners.

Is that even possible?  I already told they guy that I didn't know how to do that, and he is fine with it, but now that little voice in the back of my head keeps wanting it figured out.

Anyone have any ideas?

Link to comment
Share on other sites

  • Solution

Not perfect, but something like this

#Include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $hMain, $hRgns[2], $hRgnMain
$hMain=GUICreate("Only upper rounded",400,400,Default,Default,$WS_POPUP)
$hRgnMain=_WinAPI_CreateRectRgn(0,0,0,0)
$hRgns[0]=_WinAPI_CreateRectRgn(0,200,400,400)
$hrgns[1]=_WinAPI_CreateRoundRectRgn(0,0,400,400,20,20)

GUISetBkColor(0x0000EE)
_WinAPI_CombineRgn($hRgnMain,$hRgns[0],$hRgns[1],$RGN_OR)

_WinAPI_SetWindowRgn($hMain,$hRgnMain)

GUISetState()

While 1
    $msg=GUIGetMsg()
    If $msg=$GUI_EVENT_CLOSE Then ExitLoop
Wend

For $i=0 To UBound($hRgns)-1
    _WinAPI_DeleteObject($hRgns[$i])
Next
_WinAPI_DeleteObject($hRgnMain)

You can also create GDIPlusPath (create lines and arcs), then convert it to GDIPlusRegion, and then that to GDIRegion

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...