CodeTinkerer Posted September 18, 2015 Posted September 18, 2015 I am developing an application with some custom graphics. I found this function here. it works perfectly but I was wondering; is there a way to round only the top or bottom two corners? Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) Dim $pos, $ret, $ret2 $pos = WinGetPos($h_win) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3) If $ret[0] Then $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1) If $ret2[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf EndFunc ;==>_GuiRoundCorners
ahmet Posted September 18, 2015 Posted September 18, 2015 Example for _WinAPI_CreateRoundRectRgn() in helpfile might be useful.You can create two regions. First one would have height equals total window height reduced by the radius of corners. Second one would be rounded rectangular region whose height equals twice the radius.If something is unclear ask.
CodeTinkerer Posted September 18, 2015 Author Posted September 18, 2015 Yes, I understand _WinAPI_CreateRoundRectRgn() does the same thing as :DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)But that doesnt answer my question, it adjusts the region as a rectangle meaning it will always adjust for 4 corners. Is there a system used for point to point corners or single corners?
ahmet Posted September 18, 2015 Posted September 18, 2015 You create two regions, one with _WinAPI_CreateRectRgn(), other with _WinAPI_CreateRoundRectRgn(), and teh you combine them.
CodeTinkerer Posted September 18, 2015 Author Posted September 18, 2015 (edited) Amazing, got my desired outcome with: Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x2, $i_y2, $i_x3, $i_y3) Local $XS_pos, $XS_reta, $XS_retb, $XS_ret2 $XS_pos = WinGetPos($h_win) $XS_reta = _WinAPI_CreateRoundRectRgn ( 0, 0, $XS_pos[2], $XS_pos[3]-30, $i_x3, $i_y3 ) $XS_retb = _WinAPI_CreateRectRgn (0, $XS_pos[2]-$XS_pos[1]/2, $XS_pos[2], $XS_pos[3] ) $XS_retc = _WinAPI_CombineRgn ( $XS_reta, $XS_reta, $XS_retb, $RGN_OR ) _WinAPI_DeleteObject($XS_retb) _WinAPI_SetWindowRgn($h_win, $XS_reta) EndFunc ;==>_GuiRoundCorners Thank you for your assistance! Edited September 18, 2015 by CodeTinkerer
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now