Seminko Posted December 9, 2014 Posted December 9, 2014 Hey fellas, I have this GUI $Form1 = GUICreate("", 300, 200, -1, -1, $WS_POPUP) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") $Pic1 = GUICtrlCreatePic("F:\Excel shit\WebTarget\GUI_Small copy.jpg", 0, 0, 300, 200) GUICtrlSetOnEvent(-1, "Form1Close") $Label1 = GUICtrlCreateLabel($CurrentBalance & $FinalResultOvertime, 4, 80, 292, 76, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1, 30, 400, 0, "Arial") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x00295d) $button1 = GUICtrlCreateButton("Enter", 110, 80, 75, 20) GuiCtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_HIDE)) GUICtrlSetOnEvent(-1, "Form1Close") GUISetState(@SW_SHOW) What I need is the $Pic1 to be a PNG image with semi-transparent shadows around. I googled and found out I am supposed to use GDI+. Unfortunately, I have no idea as to how to update my GUI code. Could someone help pls? Thanks
UEZ Posted December 10, 2014 Posted December 10, 2014 Have a look to the first example (>Display images from memory in controls) in the File to Base64 String Code Generator topic. Instead of using a bitmap from the binary string you can load a PNG image. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Seminko Posted December 10, 2014 Author Posted December 10, 2014 (edited) Hez UEZ, that example is pretty overwhelming. What of your example do I need? I suppose this: #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global $hBitmap, $hGUI $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap(>>>path to an image<<<) $Form1 = GUICreate("", 300, 200, -1, -1, $WS_POPUP) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") $Pic1 = GUICtrlCreatePic(>>>path to an image<<<, 0, 0, 300, 200) GUICtrlSetOnEvent(-1, "Form1Close") $Label1 = GUICtrlCreateLabel($CurrentBalance & $FinalResultOvertime, 4, 80, 292, 76, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetFont(-1, 30, 400, 0, "Arial") GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetBkColor(-1, 0x00295d) $button1 = GUICtrlCreateButton("Enter", 110, 80, 75, 20) GuiCtrlSetState(-1, BitOR($GUI_DEFBUTTON, $GUI_HIDE)) GUICtrlSetOnEvent(-1, "Form1Close") GUISetState(@SW_SHOW) _WinAPI_DisplayTransparentBitmapInGUI($hBitmap, $hGUI) Func Form1Close() _GDIPlus_BitmapDispose($hImage) _GDIPlus_Shutdown() GuiDelete($Form1) EndFunc I won't be reading the image from memory (at least I guess I won't for the time being). Edited December 10, 2014 by Seminko
Solution Yashied Posted December 10, 2014 Solution Posted December 10, 2014 This is my example from other forum.http://autoit-script.ru/index.php?topic=5090.msg36976#msg36976 expandcollapse popup#Include <APIConstants.au3> #Include <ComboConstants.au3> #Include <GDIPlus.au3> #Include <GUIConstantsEx.au3> #Include <WinAPIEx.au3> Global Const $SC_DRAGMOVE = 0xF012 _GDIPlus_Startup() $hPng = _GDIPlus_ImageLoadFromFile(@ScriptDir & '\1660807.png') $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hPng) $hParent = GUICreate('', 579, 293, -1, -1, $WS_POPUP, $WS_EX_LAYERED) _WinAPI_UpdateLayeredWindowEx($hParent, -1, -1, $hBitmap, 255, 1) _GDIPlus_ImageDispose($hPng) _GDIPlus_Shutdown() $hForm = GUICreate('', 563, 180, -1, -1, $WS_POPUP, -1, $hParent) GUISetBkColor(0x314B89) GUICtrlCreatePic(@ScriptDir & '\1660807.bmp', 0, 0, 563, 180) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateCombo('Option1', 270, 8, 285, 140, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, 'Option2|Option3|Option4', 'Option1') $Label = GUICtrlCreateLabel('Loading...', 10, 74, 60, 14) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) $Button = GUICtrlCreateButton('Exit', 476, 150, 80, 23) GUIRegisterMsg($WM_MOVE, 'WM_MOVE') GUIRegisterMsg($WM_NCHITTEST, 'WM_NCHITTEST') WM_MOVE($hParent, $WM_MOVE, 0, 0) GUISetState(@SW_SHOW, $hParent) GUISetState(@SW_SHOW, $hForm) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button Exit Case $Label _SendMessage($hParent, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch WEnd Func WM_MOVE($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hParent Local $Pos = WinGetPos($hParent) If IsArray($Pos) Then WinMove($hForm, '', $Pos[0] + 13, $Pos[1] + 100) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_MOVE Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) Switch $hWnd Case $hForm _SendMessage($hParent, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) Case $hParent Return $HTCAPTION EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NCHITTESTTransparent.zip 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...
Seminko Posted December 10, 2014 Author Posted December 10, 2014 (edited) This is my example from other forum.http://autoit-script.ru/index.php?topic=5090.msg36976#msg36976 Thanks man, I figured it out thanks to you! If you could help me further. I don't do all the Switch / Case / Endswitch thing. I want my script to run in the background and when a hotkey is pressed I want the GUI to show up. So everytime the function is called my script runs GUICreate and when done the script runs GUIDelete, which is not ideal, obviously. Is there a way for the gui to be hidden and called and not to be created everytime? I mean will that help with speed or it doesn't matter? Edited December 10, 2014 by Seminko
Moderators SmOke_N Posted December 12, 2014 Moderators Posted December 12, 2014 WinSetState(), GUISetState()? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Seminko Posted December 13, 2014 Author Posted December 13, 2014 WinSetState(), GUISetState()? Thanks man, unfortunately, that doesn't make the script any faster than GUIDelete, GUICreate
Moderators SmOke_N Posted December 15, 2014 Moderators Posted December 15, 2014 I'm not sure what you mean by doesn't make it faster. But I'll assure you of this... if you have controls with your GUI, it certainly does make the rendering many times faster. Just on logic alone: GUICreate() GUICtrlCreate() etc... GUISetState() Vs. just: GUISetState() Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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