lillo78 Posted September 25, 2017 Share Posted September 25, 2017 Hi, i've created a GUI with a background .png file using GDI+ . If i minimize and then restore the background is not shown anymore, same thing happens when maximizing the GUI Here's the basic code where the gui is created. _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($FILEPATH_BACKGROUND) ; Create a GUI with various controls. Local $hGUI = GUICreate("My GUI", $WIDTH, $HEIGHT) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW, $hGUI) #Region Background Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;create a Graphics object from a window handle _GDIPlus_GraphicsClear($hGraphics, 0xFF404040) ;clear graphic handle with dark grey (background) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;sets the graphics object rendering quality (antialiasing) Local $hTexture = _GDIPlus_TextureCreate($hImage) _GDIPlus_GraphicsFillRect($hGraphics, -1, -1, $WIDTH, $HEIGHT, $hTexture) ;draw rectangle with texture as a brush #EndRegion Background any help will be much appreciated. Thnx. Link to comment Share on other sites More sharing options...
UEZ Posted September 25, 2017 Share Posted September 25, 2017 You have to repaint the graphic on $GUI_EVENT_RESTORE event. 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
lillo78 Posted September 26, 2017 Author Share Posted September 26, 2017 Thnak you @UEZ appreciate it! Link to comment Share on other sites More sharing options...
Zedna Posted January 19, 2018 Share Posted January 19, 2018 Better to do painting in event WM_PAINT so your window will be correctly repainted also when other external overlapping window/application will move away from that position on top of your window. Use: GUIRegisterMsg($WM_PAINT, 'MY_WM_PAINT') Search this code on this forum for plenty of existing examples ... Resources UDF ResourcesEx UDF AutoIt Forum Search 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