BigOneWay Posted May 1, 2017 Posted May 1, 2017 Hi Under an old Malkey's script, posted in 2012, runs the refresh after minimizing a GDI+ graphic mask, but the button and the listview disappear. How to refresh the GDI+ graphics and the normal buttons. Excuse my bad English. expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <GuiListView.au3> Global $hBMPBuff, $hGraphicGUI _Main() Func _Main() Local $hGUI, $hEndCap, $hGraphic $hGUI = GUICreate("GDI+", 400, 300, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX)) GUISetState() $CheckBox = GUICtrlCreateButton('Example', 10, 10, 70, 40) $ListV1= GUICtrlCreateListView('', 150, 10, 100, 100 ) _GUICtrlListView_SetBkColor($ListV1, 0x00FFFF) _GUICtrlListView_SetTextBkColor($ListV1, 0x00FFFF) _GUICtrlListView_SetExtendedListViewStyle($ListV1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) _GUICtrlListView_InsertColumn($ListV1, 0, "Column 1", 100) _GUICtrlListView_AddItem($ListV1, "Hello", 1) _GDIPlus_Startup() $hGraphicGUI = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBMPBuff = _GDIPlus_BitmapCreateFromGraphics(400, 300, $hGraphicGUI) ; Create bitmap the same size as the graphics of the GUI. $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBMPBuff) ; Create graphics for bitmap, $hBMPBuff. (where the graphics is like the canvas of the bitmap) $hPen = _GDIPlus_PenCreate(0xFFFF0000, 2) ; Hex colour format 0xAARRGGBB - Alpha (transparency), Red, Green, Blue. $hEndCap = _GDIPlus_ArrowCapCreate(3, 6) _GDIPlus_PenSetCustomEndCap($hPen, $hEndCap) ; Draw arrows to bitmap _GDIPlus_GraphicsDrawLine($hGraphic, 10, 120, 390, 120, $hPen) _GDIPlus_PenSetWidth($hPen, 4) _GDIPlus_GraphicsDrawLine($hGraphic, 10, 150, 390, 150, $hPen) _GDIPlus_PenSetWidth($hPen, 6) _GDIPlus_GraphicsDrawLine($hGraphic, 10, 180, 390, 180, $hPen) _GDIPlus_GraphicsDrawImage($hGraphicGUI, $hBMPBuff, 0, 0) ; Draw bitmap to GUI (graphics). ; Loop until user exits GUIRegisterMsg(0x000F, "WM_PAINT") ;$WM_PAINT Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_ArrowCapDispose($hEndCap) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hGraphicGUI) _WinAPI_DeleteObject($hBMPBuff) _GDIPlus_Shutdown() EndFunc ;==>_Main Func WM_PAINT($hGUI, $iMsg, $wParam, $lParam) _GDIPlus_GraphicsDrawImage($hGraphicGUI, $hBMPBuff, 0, 0) _WinAPI_RedrawWindow($hGUI, 0, 0, $RDW_VALIDATE) Return 'GUI_RUNDEFMSG' EndFunc ;==>WM_PAINT Thanks in advance.
UEZ Posted May 1, 2017 Posted May 1, 2017 Try this: expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <GuiListView.au3> Global $hBMPBuff, $hGraphicGUI _Main() Func _Main() Local $hGUI, $hEndCap, $hGraphic $hGUI = GUICreate("GDI+", 400, 300, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX)) $CheckBox = GUICtrlCreateButton('Example', 10, 10, 70, 40) $ListV1= GUICtrlCreateListView('', 150, 10, 100, 100 ) _GUICtrlListView_SetBkColor($ListV1, 0x00FFFF) _GUICtrlListView_SetTextBkColor($ListV1, 0x00FFFF) _GUICtrlListView_SetExtendedListViewStyle($ListV1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) _GUICtrlListView_InsertColumn($ListV1, 0, "Column 1", 100) _GUICtrlListView_AddItem($ListV1, "Hello", 1) GUISetState() _GDIPlus_Startup() $hGraphicGUI = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hBMPBuff = _GDIPlus_BitmapCreateFromGraphics(400, 300, $hGraphicGUI) ; Create bitmap the same size as the graphics of the GUI. $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBMPBuff) ; Create graphics for bitmap, $hBMPBuff. (where the graphics is like the canvas of the bitmap) ;exclude controls from GDI+ grapphic region Local $hRegion = _GDIPlus_RegionCreateFromRect(0, 0, 400, 300) Local $hChild = _WinAPI_GetWindow($hGUI, $GW_CHILD) Local $aRect Do $aRect = ControlGetPos($hChild, "", 0) _GDIPlus_RegionCombineRect($hRegion, $aRect[0], $aRect[1], $aRect[2], $aRect[3], 3) $hChild = _WinAPI_GetWindow($hChild, $GW_HWNDNEXT) Until Not $hChild _GDIPlus_GraphicsSetClipRegion($hGraphic, $hRegion) _GDIPlus_RegionDispose($hRegion) $hPen = _GDIPlus_PenCreate(0xFFFF0000, 2) ; Hex colour format 0xAARRGGBB - Alpha (transparency), Red, Green, Blue. $hEndCap = _GDIPlus_ArrowCapCreate(3, 6) _GDIPlus_PenSetCustomEndCap($hPen, $hEndCap) ; Draw arrows to bitmap _GDIPlus_GraphicsDrawLine($hGraphic, 10, 120, 390, 120, $hPen) _GDIPlus_PenSetWidth($hPen, 4) _GDIPlus_GraphicsDrawLine($hGraphic, 10, 150, 390, 150, $hPen) _GDIPlus_PenSetWidth($hPen, 6) _GDIPlus_GraphicsDrawLine($hGraphic, 10, 180, 390, 180, $hPen) _GDIPlus_GraphicsDrawImage($hGraphicGUI, $hBMPBuff, 0, 0) ; Draw bitmap to GUI (graphics). ; Loop until user exits GUIRegisterMsg(0x000F, "WM_PAINT") ;$WM_PAINT Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_RESTORE RepaintGDIp() EndSwitch Until False ; Clean up resources _GDIPlus_ArrowCapDispose($hEndCap) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hGraphicGUI) _WinAPI_DeleteObject($hBMPBuff) _GDIPlus_Shutdown() EndFunc ;==>_Main Func WM_PAINT($hGUI, $iMsg, $wParam, $lParam) RepaintGDIp() ;~ _WinAPI_RedrawWindow($hGUI, 0, 0, BitOR($RDW_INVALIDATE, $RDW_ALLCHILDREN)) Return 'GUI_RUNDEFMSG' EndFunc ;==>WM_PAINT Func RepaintGDIp() _GDIPlus_GraphicsDrawImage($hGraphicGUI, $hBMPBuff, 0, 0) EndFunc I don't know whether this will work properly on WinXP machines but who cares... 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
BigOneWay Posted May 1, 2017 Author Posted May 1, 2017 Thanks for the quick response. Autoit is a program Simply Exceptional and exceptionally simple, except when you put your hands on it. I'm joking, you always have my greatest respect. Correct if I'm wrong, you created a child gui as a layer, So, the update is the sum of the normal window and the secondary window that contains the graphics gdi .. no I did not understand, I must study it still long time. In any case, 'GUIRegisterMsg (0x000F, "WM_PAINT")' is no longer needed. Thanks again.
UEZ Posted May 1, 2017 Posted May 1, 2017 15 minutes ago, BigOneWay said: Thanks for the quick response. Autoit is a program Simply Exceptional and exceptionally simple, except when you put your hands on it. I'm joking, you always have my greatest respect. Correct if I'm wrong, you created a child gui as a layer, So, the update is the sum of the normal window and the secondary window that contains the graphics gdi .. no I did not understand, I must study it still long time. In any case, 'GUIRegisterMsg (0x000F, "WM_PAINT")' is no longer needed. Thanks again. No, I haven't created a child window. $hChild enumerates all controls to exclude the regions from the graphic handle. In you case not necessarily needed but something which can be added if your objects crossing control positions. WM_PAINT is needed in the case when you drag the window outside the desktop and back again. 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
BigOneWay Posted May 1, 2017 Author Posted May 1, 2017 You did me not even give me time to say I'm wrong, you're too fast, and I'm too old for these things. I have seen that _GDIPlus_RegionCombineRect lists normal objects, in fact, if there are no objects, it generates an error. However, if you want to take a look at an old project that goes very slowly, just to tell me if it's time lost or not. I've always been a passionate about the button style etched of access, and I wanted to try to do it in autoit. _GDIBStyle.au3 _GDIButton.au3 Demo.au3
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