ZetupEXE Posted December 11, 2009 Share Posted December 11, 2009 Hi there, well thanks a lot to this Forum i've got several good ideas and hints for solving problems with autoIT. The Forum helps me a lot like for doin this: http://www.911cd.net/forums//index.php?showtopic=22523 but now i've got a problem, that's going to make me crazy. hope you guys can help me out. i like to have a transparent gui, and within this gui, i like to have a picture with transparent background. the picture have a drop shadow, is an png file with alpha channel and should be placed within the gui. my aim is to get the transparent gui with the picture inside to look smooth. well, my english isn't as good as it should be, so please take the example script and get an idea of what my problem is. the edge of the picture is crispy. if someone knew how to get the picture looking smooth with or without gui, my thanks is yours. cu Zetup-exetest.zip Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 11, 2009 Moderators Share Posted December 11, 2009 ZetupEXE, It looks as if some of the pixels on the edge of the shadow have the same value as the background, which gives you the ragged/"crispy" look when they too become transparent. If you were to replace the background with another colour value you might be able to get a smoother look - all will depend on your skill in choosing the correct pixels on the shadow edge to change/leave alone. I hope you had nothing planned over Xmas, because it might well take some time......... M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ZetupEXE Posted December 11, 2009 Author Share Posted December 11, 2009 @Melba23: Thanks for you advice. I tried a lot of colors (mabe thousands ) but it doesnt work. the crispy look is where the smooth black drop shadow goes! so i think it's rather, that the color which should be transparent isn't exactly the "transparentcolor" anymore. Link to comment Share on other sites More sharing options...
martin Posted December 11, 2009 Share Posted December 11, 2009 (edited) @Melba23: Thanks for you advice. I tried a lot of colors (mabe thousands ) but it doesnt work. the crispy look is where the smooth black drop shadow goes! so i think it's rather, that the color which should be transparent isn't exactly the "transparentcolor" anymore. I am no expert on transparency but I think you are almost doomed to fail. To make the effect you want the window and button have to be redrawn every time the background changes. If the background stays the same then there is an easy way to do waht you want. If you run the script using your mouse then you have 2 seconds to place the mouse cursor where you want the button to appear. expandcollapse popup; *** Start added by AutoIt3Wrapper *** #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <screencapture.au3> ; *** End added by AutoIt3Wrapper *** #AutoIt3Wrapper_Add_Constants=n ;Global Const $GUI_DISABLE = 128 #include "G:\icons\Icons.au3" Sleep(2000) ButtonGui() ; ButtonGui (Gui welche beim Drücken des mittleren Mausbuttons aufgerufen wird) Func ButtonGui() Local $mousepos = MouseGetPos() MouseMove($mousepos[0] - 50, $mousepos[1], 0) _ScreenCapture_Capture("fake.jpg", $mousepos[0] - 24, $mousepos[1] - 24, $mousepos[0] + 104, $mousepos[1] + 104) MouseMove($mousepos[0], $mousepos[1], 0) $bc = PixelGetColor($mousepos[0], $mousepos[1]) $buttonGUI = GUICreate("ButtonGUI", 65, 60, $mousepos[0] - 24, $mousepos[1] - 24, $WS_POPUP + $WS_VISIBLE + $DS_SETFOREGROUND, BitOR(0x2000000, $WS_EX_TOOLWINDOW));, $WS_EX_LAYERED)) $buttonPic = GUICtrlCreatePic("", 1, 1, 64, 64) _SetImage($buttonPic, "startButton.png") $bg = GUICtrlCreatePic("fake.jpg", 0, 0, 128, 128) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetState($buttonPic, $GUI_DISABLE) Sleep(9000) Exit GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd EndFunc ;==>ButtonGui EDIT:Added mouse moves so cursor was not included in screen capture. Edited December 11, 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. Link to comment Share on other sites More sharing options...
picea892 Posted December 11, 2009 Share Posted December 11, 2009 (edited) Sometimes changing the transparent colour gives a different effect. I've had the same issue using an extracted icon and found darker colours work better. GUISetBkColor(0x000000) _API_SetLayeredWindowAttributes($buttonGUI,0x000000,255);set special colour fully transparent Edited December 11, 2009 by picea892 Link to comment Share on other sites More sharing options...
Yashied Posted December 11, 2009 Share Posted December 11, 2009 (edited) expandcollapse popup#Include <GUIConstantsEx.au3> #Include <Icons.au3> #Include <WinAPIEx.au3> $hForm = GUICreate('', 64, 64, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $hBitmap = _Icons_Bitmap_Load(@ScriptDir & '\startButton.png') GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() _SetBitmap($hForm, $hBitmap, 255) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _SetBitmap($hWnd, $hBitmap, $iOpacity) Local $hDC, $hMemDC, $tBlend, $tSize, $tSource $hDC = _WinAPI_GetDC($hWnd) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = _WinAPI_GetBitmapDimension($hBitmap) $tSource = DllStructCreate($tagPOINT) $tBlend = DllStructCreate($tagBLENDFUNCTION) DllStructSetData($tBlend, 'Alpha', $iOpacity) DllStructSetData($tBlend, 'Format', 1) _WinAPI_UpdateLayeredWindow($hWnd, $hDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC($hWnd, $hDC) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>_SetBitmap Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hForm Return $HTCAPTION EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NCHITTESTIcons.au3WinAPIEx.au3 Edited December 11, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
martin Posted December 11, 2009 Share Posted December 11, 2009 That's nice Yashied! Shame on me, I'd forgotten about your icons.au3. 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. Link to comment Share on other sites More sharing options...
Authenticity Posted December 11, 2009 Share Posted December 11, 2009 Very good Yashied, thanks. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 11, 2009 Moderators Share Posted December 11, 2009 Yashied,браво!M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
ZetupEXE Posted December 14, 2009 Author Share Posted December 14, 2009 YES! that's it! thanks a lot Link to comment Share on other sites More sharing options...
UTA Posted December 14, 2009 Share Posted December 14, 2009 expandcollapse popup#Include <GUIConstantsEx.au3> #Include <Icons.au3> #Include <WinAPIEx.au3> $hForm = GUICreate('', 64, 64, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $hBitmap = _Icons_Bitmap_Load(@ScriptDir & '\startButton.png') GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() _SetBitmap($hForm, $hBitmap, 255) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _SetBitmap($hWnd, $hBitmap, $iOpacity) Local $hDC, $hMemDC, $tBlend, $tSize, $tSource $hDC = _WinAPI_GetDC($hWnd) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = _WinAPI_GetBitmapDimension($hBitmap) $tSource = DllStructCreate($tagPOINT) $tBlend = DllStructCreate($tagBLENDFUNCTION) DllStructSetData($tBlend, 'Alpha', $iOpacity) DllStructSetData($tBlend, 'Format', 1) _WinAPI_UpdateLayeredWindow($hWnd, $hDC, 0, DllStructGetPtr($tSize), $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) _WinAPI_ReleaseDC($hWnd, $hDC) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>_SetBitmap Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hForm Return $HTCAPTION EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NCHITTEST Icons.au3 WinAPIEx.au3 This code is perfect for a splashscreen. But how do I get it work with some more transparent PNGs on the gui? At the moment the form is resized to the bitmap-size. 1) But what if I want to have more than one bitmap? 2) Also I tried WinAPI_UpdateLayeredWindow($hWnd, $hDC, 0, 0, $hMemDC, DllStructGetPtr($tSource), 0, DllStructGetPtr($tBlend), $ULW_ALPHA) like it is mentioned in the helpfile but that doesn't work. 2a) How can i prevent the form to resize itself to the bitmap-size without loosing transparency? 2b) Or how is it possible to resize it to a fixed (bigger) size than the bitmap without loosing transparency? UTA 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