qwert Posted January 24, 2015 Share Posted January 24, 2015 I’ve only worked with gradients for a few hours. But one of my very first test scripts has a big problem: The contents of the GUI vanishes when any other window gains focus. #Include <WinAPIEx.au3> Global $aVertex[2][3] = [[0, 0, 0x81F70F], [200, 600, 0x002F2F]] $hForm = GUICreate('MyGUI', 200, 600) $hDC = _WinAPI_GetDC($hForm) GUISetState() _WinAPI_GradientFill($hDC, $aVertex, 0, 1) _WinAPI_ReleaseDC($hForm, $hDC) Do Until GUIGetMsg() = -3 I've tried moving the ReleaseDC to the very bottom ... and a couple of variations of GUISetState. How do I lock the gradient in place until the GUI is deleted? Thanks in advance for any help. Link to comment Share on other sites More sharing options...
Yashied Posted January 24, 2015 Share Posted January 24, 2015 #Include <GUIConstantsEx.au3> #Include <WinAPIEx.au3> Global Const $STM_SETIMAGE = 0x0172 Dim $aVertex[2][3] = [[0, 0, 0x81F70F], [200, 600, 0x002F2F]] $hDC = _WinAPI_CreateCompatibleDC(0) $hBitmap = _WinAPI_CreateBitmap(200, 600, 1, 32) $hSv = _WinAPI_SelectObject($hDC, $hBitmap) _WinAPI_GradientFill($hDC, $aVertex, 0, 1) _WinAPI_SelectObject($hDC, $hSv) _WinAPI_DeleteDC($hDC) $hForm = GUICreate('MyGUI', 200, 600) GUICtrlCreatePic('', 0, 0, 200, 600) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSendMsg(-1, $STM_SETIMAGE, 0, $hBitmap) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE 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...
qwert Posted January 24, 2015 Author Share Posted January 24, 2015 Thank you for the quick response. It gives exactly the result I'd hoped to get ... although I admit that I'm not far enough into working with gradient fills to understand exactly the differences. But that's OK. I'll take this as my new baseline example and look forward to learning more as I go. I appreciate your help. 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