dantay9 Posted June 22, 2009 Posted June 22, 2009 (edited) I have a script with a png in the middle and child guis around the outside. When you scroll the mouse, the child windows move in a circle. The png in the center works fine, but the background overlaps with the child windows when they revolve around the center. Is there a way to make the png circular or something else that fixes the overlap without putting the png into a new window?New_AutoIt_v3_Script.au3 Edited June 22, 2009 by dantay9
picea892 Posted June 22, 2009 Posted June 22, 2009 You have 900 views on this post with zero responses. Tells me that you need to provide more information or provide a simpler example.It sounds like you need a way to turn a square gui into a circle.....is that correct?I did this for fun on a clock in the forum. See my post #18http://www.autoitscript.com/forum/index.ph...15&start=15I used this function, modified so it was more than just "round corners"_GuiRoundCorners($hWnd, 24, 43, 200, 200) 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]-22, "long", $pos[3]-22, "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
dantay9 Posted June 22, 2009 Author Posted June 22, 2009 (edited) Thank you for replying. Correct me if I am wrong, but GUIRoundCorners will only work on a window, not a picture. I will try to provide more information. I want to provide the whole example to show exactly what my problem is. I placed comments and space around the code that makes the png picture. Hope this helps. Edited June 22, 2009 by dantay9
martin Posted June 22, 2009 Posted June 22, 2009 Thank you for replying. Correct me if I am wrong, but GUIRoundCorners will only work on a window, not a picture. I will try to provide more information. I want to provide the whole example to show exactly what my problem is. I placed comments and space around the code that makes the png picture. Hope this helps. After the line in your for/next loop where you create the child windows, add these 2 lines. $iFlags = BitOR($SWP_SHOWWINDOW, $SWP_NOSIZE, $SWP_NOMOVE) _WinAPI_SetWindowPos(Eval("GUI" & $x), $HWND_TOP, 0, 0, 0, 0, $iFlags) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
dantay9 Posted June 23, 2009 Author Posted June 23, 2009 Thanks martin. You're always a bunch of help. That worked great. I have two small problems though. 1. Only one child window shows up before you use the mouse wheel to rotate them. 2. When I rotate the child windows, if the window started overlapped with the center png, that transfers to the child window. Rotate the windows a little and you'll see what I mean. I think this problem will be fixed if #1 is fixed. Thanks for all your help.New_AutoIt_v3_Script.au3
martin Posted June 23, 2009 Posted June 23, 2009 (edited) Thanks martin. You're always a bunch of help. That worked great. I have two small problems though. 1. Only one child window shows up before you use the mouse wheel to rotate them. 2. When I rotate the child windows, if the window started overlapped with the center png, that transfers to the child window. Rotate the windows a little and you'll see what I mean. I think this problem will be fixed if #1 is fixed. Thanks for all your help. When you create the child guis you are making them all at the top because you have used 0 for the angle. You need Assign("GUI" & $x, GUICreate("Top", $Width, $Width, $cx + $wrad * Sin(Eval($x & "Angle") * ATan(1) / 45) - ($Width / 2), _ $cy - $wrad * Cos(Eval($x & "Angle") * ATan(1) / 45) - ($Width / 2), $WS_CHILD, -1, $GUI0)) Which is what you do when the scroll wheel operates. I find your use of Assign makes the script more difficult to read and it must make it more difficult to write. I recommend that you consider using an array for the child windows which would mean you wouldn't need to use Assign or Eval. An array would make things much simpler I think. Eg Global $hChild[$Outer_Items], $Angle[$Outer_Items] For $x = 0 To $Outer_Items - 1 $Angle[$x] = -$x *8* ATan(1) / $Outer_Items $hChild[$x] = GUICreate("Top", $Width, $Width, $cx + $wrad * Sin($Angle[$x]) - $Width/2, _ $cy - $wrad * Cos($Angle[$x] ) - $Width/2, $WS_CHILD, -1, $GUI0) etc [/code Edited June 24, 2009 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
dantay9 Posted June 25, 2009 Author Posted June 25, 2009 (edited) Thanks Martin. I will use your advice and remove the assigns. Your solution worked great. Here's the fixed code.New_AutoIt_v3_Script.au3 Edited June 25, 2009 by dantay9
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