GaryFrost Posted June 14, 2005 Share Posted June 14, 2005 (edited) #include <GuiConstants.au3> $my_gui = GUICreate(" SkinIt", 300, 300) $button = GUICtrlCreateButton("Exit", 35, 10) _MyForm($my_gui) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $button ExitLoop Case Else ;;; EndSelect WEnd Exit Func _MyForm($h_win) Dim $ret, $ret2, $ret3, $ret4 $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", 48, "long", 48, "long", 300, "long", 200, "long", 20, "long", 20) If IsArray($ret) Then $ret2 = DllCall("gdi32.dll", "long", "CreateEllipticRgn", "long", 16, "long", 4, "long", 90, "long", 80) If IsArray($ret2) Then $ret3 = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", 48, "long", 200, "long", 300, "long", 220, "long", 20, "long", 20) If IsArray($ret3) Then $ret4 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 245, "long", 4, "long", 300, "long", 29) If IsArray($ret4) Then DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret2[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret3[0], "long", $ret3[0], "long", $ret[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret4[0], "long", $ret4[0], "long", $ret3[0], "int", 2) $ret5 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret4[0], "int", 1) If $ret5[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf Else Return 0 EndIf Else Return 0 EndIf Else Return 0 EndIf EndFunc ;==>_MyForm Edited June 14, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Helge Posted June 14, 2005 Share Posted June 14, 2005 Hmmm ! Really nice, Gary ! Ooh, and thanks for all the great UDFs you've made ! Link to comment Share on other sites More sharing options...
GaryFrost Posted June 14, 2005 Author Share Posted June 14, 2005 Just going thru all my old vb code, converting some over to AutoIt And your welcome. Gary SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GaryFrost Posted June 14, 2005 Author Share Posted June 14, 2005 Func _MyForm2($h_win) Dim $ret, $ret2, $ret3, $ret4 $ret = DllCall("gdi32.dll", "long", "CreateEllipticRgn", "long", 0, "long", 0, "long", 100, "long", 100) $ret2 = DllCall("gdi32.dll", "long", "CreateEllipticRgn", "long", 90, "long", 0, "long", 190, "long", 100) $ret3 = DllCall("gdi32.dll", "long", "CreateEllipticRgn", "long", 180, "long", 0, "long", 280, "long", 100) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret2[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret3[0], "int", 2) $ret5 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1) EndFunc SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
layer Posted June 14, 2005 Share Posted June 14, 2005 Awesome! 8) FootbaG Link to comment Share on other sites More sharing options...
Valuater Posted June 14, 2005 Share Posted June 14, 2005 (edited) Wow.... you know what your doing and ....You have great timingI just ran into this problem yesterday about rounded cornersNice work... and thanks again8) Edited October 14, 2005 by Valuater Link to comment Share on other sites More sharing options...
blindwig Posted June 14, 2005 Share Posted June 14, 2005 @gafrost: As long as you're having fun with transparent regions... A while back I wrote a routine in VB6 that would take a GIF file as input, and create a titleless/borderless form the size of the GIF, and apply that GIF as the form background. If the GIF was transparent, it would region the transparent areas as transparent on the form. This way I could make custom-shaped forms easily - using any GIF editor, no more programming required. Think you can tackle that task in AutoIt? I could try to dig up my VB6 project source, but it looks like you already know pretty well what you're doing. Oh yeah - I did mine using multiple horizontal lines as regions. If you think of a better way, I'd love to hear about it! Anyway, just an idea, if you're looking for something to code... My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
GaryFrost Posted June 14, 2005 Author Share Posted June 14, 2005 @gafrost:As long as you're having fun with transparent regions...A while back I wrote a routine in VB6 that would take a GIF file as input, and create a titleless/borderless form the size of the GIF, and apply that GIF as the form background. If the GIF was transparent, it would region the transparent areas as transparent on the form. This way I could make custom-shaped forms easily - using any GIF editor, no more programming required.Think you can tackle that task in AutoIt? I could try to dig up my VB6 project source, but it looks like you already know pretty well what you're doing.Oh yeah - I did mine using multiple horizontal lines as regions. If you think of a better way, I'd love to hear about it! Anyway, just an idea, if you're looking for something to code...<{POST_SNAPBACK}>I know what your talking about have some old vb code for doing that somewhere.Takes a little more, if your is like mine was it will need DllStruct and more region calls.If you want to zip up the code and image to be translated, when I have time I would be glad to give it a shot.Gary SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Nova Posted June 14, 2005 Share Posted June 14, 2005 Nice one gafrost, You never fail to amaze, ive been waiting for this for so long! My exams finish in 2 weeks, I cant wait to start playing with the above code. Thanx again, Yours greatfully, Nova. Link to comment Share on other sites More sharing options...
DaLiMan Posted June 14, 2005 Share Posted June 14, 2005 Wow, this is so COOL!!! How do you come up with this stuff. I will see if I can understand the code and go play with models also. Link to comment Share on other sites More sharing options...
blindwig Posted June 14, 2005 Share Posted June 14, 2005 I know what your talking about have some old vb code for doing that somewhere.Takes a little more, if your is like mine was it will need DllStruct and more region calls.If you want to zip up the code and image to be translated, when I have time I would be glad to give it a shot.Gary<{POST_SNAPBACK}>Not that I need it translated per se, but you seem to be on a roll with transparent GUI effects, so I thought you'd be interested...anyway, here's my old VB source. It's not commented, but it's short and sweet and shouldn't be hard to figure out. It might not be terrible effecient - it's one of the first external-dll-call programs I ever wrote.Anyway, here goes nothing...Alpha_Notice_src.zip My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
GaryFrost Posted June 15, 2005 Author Share Posted June 15, 2005 (edited) Think it needs some work, don't have my vb compiler installed so I can see what it's suppose to look like. But this conversion of the function should get you started. expandcollapse popupFunc _GetBitmapRegion($cPicture, $cTransparent) Dim $hRgn, $tRgn, $obj Dim $X, $Y, $X0 Dim $hDC, $BM Dim $BM Dim $bmType = 1 Dim $bmWidth = 2 Dim $bmHeight = 3 Dim $bmWidthBytes = 4 Dim $bmPlanes = 5 Dim $bmBitsPixel = 6 Dim $bmBits = 7 $BM = DllStructCreate ("int;int;int;int;int;int;int") If @error Then MsgBox(0, "", "Error in DllStructCreate " & @error); Exit EndIf $hDC = DllCall("gdi32.dll", "long", "CreateCompatibleDC", "long", 0) If $hDC[0] Then DllCall("gdi32.dll", "long", "SelectObject", "long", $hDC[0], "long", $cPicture) DllCall("gdi32.dll", "long", "GetObject", "long", $cPicture, "long", DllStructGetSize ($BM), "ptr", DllStructGetPtr ($BM)) $hRgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", DllStructGetData ($BM, $bmWidth), "long", DllStructGetData ($BM, $bmHeight)) For $Y = 0 To DllStructGetData ($BM, $bmHeight) For $X = 0 To DllStructGetData ($BM, $bmWidth) While $X <= DllStructGetData ($BM, $bmWidth) And _GetPixel($hDC[0], $X, $Y) <> $cTransparent $X = $X + 1 WEnd $X0 = $X While $X <= DllStructGetData ($BM, $bmWidth) And _GetPixel($hDC[0], $X, $Y) = $cTransparent $X = $X + 1 WEnd If $X0 < $X Then $tRgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $X0, "long", $Y, "long", $X, "long", $Y + 1) DllCall("gdi32.dll", "long", "CombineRgn", "long", $hRgn[0], "long", $hRgn[0], "long", $tRgn[0], "int", 4) DllCall("gdi32.dll", "long", "DeleteObject", "long", $tRgn[0]) EndIf Next Next $obj = DllCall("gdi32.dll", "long", "SelectObject", "long", $hDC[0], "long", $cPicture) DllCall("gdi32.dll", "long", "DeleteObject", "long", $obj[0]) EndIf DllCall("gdi32.dll", "long", "DeleteDC", "long", $hDC[0]) DllStructDelete ($BM) Return $hRgn[0] EndFunc ;==>_GetBitmapRegion Func _GetPixel($hDC, $X, $Y) Dim $c $c = DllCall("gdi32.dll", "long", "GetPixel", "long", $hDC, "long", $X, "long", $Y) Return $c[0] EndFunc ;==>_GetPixel Edited June 15, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Valuater Posted June 17, 2005 Share Posted June 17, 2005 .... Help Me! Mr. Wizard... Help Me!!! The round corners worked absolutely perfect for the radio.... thanks I have been playing with your codes trying to round the top corners and cut a curve on the bottom...... I just can't get it well... here's the project the GUI is 248 x 393 Twizle... Twazle.. Twozle...Twone Hope you can help 8) Link to comment Share on other sites More sharing options...
blindwig Posted June 18, 2005 Share Posted June 18, 2005 plug in your bitmap and bitmap size and transparent color... (quickly whipped)<{POST_SNAPBACK}>I think it was LazyCat that wrote a routine for extracting image file size from an image file. Search for that and plug it in and you won't have to do it manually. My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions Link to comment Share on other sites More sharing options...
Valuater Posted June 18, 2005 Share Posted June 18, 2005 Thanks Larry, I couldn't get it to work.... nothing showed, just an icon in the icon tray so, I put a "; " semicolon in front of the function call to test my stuff like this $file = "C:\XPClean-web\Settings\XPClean-pics\GPS-2.jpg" ; ".\mybmp.bmp" $bmpwidth = 248 $bmpheight = 393 $transparentcolor = 0xffffff ;>>>> I didn't change this $my_gui = GUICreate(" SkinIt", $bmpheight +10, $bmpheight + 10 ,-1,-1,$WS_POPUP) GUICtrlCreatePic($file, 0, 0, $bmpwidth, $bmpheight ) ;_SkinMyGUI($my_gui,$file,$transparentcolor ) GUISetState() and here is what i got ???.... sorry, I dont know how to test other than this Thanks Larry 8) Link to comment Share on other sites More sharing options...
Valuater Posted June 18, 2005 Share Posted June 18, 2005 gotta be bmp<{POST_SNAPBACK}>got it!.... thx8) Link to comment Share on other sites More sharing options...
Valuater Posted June 18, 2005 Share Posted June 18, 2005 (edited) gotta be bmp<{POST_SNAPBACK}>saved the pic as a bmp and changed the $file location..hold on that **** didn't remove the ";"the new look scary..!!I noticed the size was transparent, however was still larger than the actual bmp????.... what nextthx8) Edited June 18, 2005 by Valuater Link to comment Share on other sites More sharing options...
GaryFrost Posted June 18, 2005 Author Share Posted June 18, 2005 saved the pic as a bmp and changed the $file location..looks exactly the same... ??????thx8(*******EDIT ********* hold on that **** didn't remove the ";"<{POST_SNAPBACK}>Also make sure to change$my_gui = GUICreate(" SkinIt", $bmpheight +10, $bmpheight + 10 ,-1,-1,$WS_POPUP)to$my_gui = GUICreate(" SkinIt", $bmpwidth +10, $bmpheight + 10 ,-1,-1,$WS_POPUP) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Valuater Posted June 18, 2005 Share Posted June 18, 2005 (edited) Also make sure to change$my_gui = GUICreate(" SkinIt", $bmpwidth +10, $bmpheight + 10 ,-1,-1,$WS_POPUP)<{POST_SNAPBACK}>so far...looking better all the time... 8)thx*********** thanks guys, gone to Mexico, have a great weekend 8) Edited June 18, 2005 by Valuater Link to comment Share on other sites More sharing options...
myspacee Posted March 22, 2010 Share Posted March 22, 2010 Hello, sorry for resumin post but can't understand how create a simple rectangular hole in a GUI ... [feel stupid] anyone can help ? Thank you Link to comment Share on other sites More sharing options...
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