pinkfoyd Posted February 22, 2012 Share Posted February 22, 2012 (edited) Hi all, 1 hour i am searching but find nothing. I want to create 4 GDI graph in one GUI because _GDIPlus_GraphicsCreateFromHWND($hWnd) work but take all the $hWnd space I try to play with parent and child but without success. Someone can help ? thanks ! expandcollapse popup#include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #Region ### START Koda GUI section ### Form=h:form1.kxf $Form1 = GUICreate("Form1", 1024, 768, 269, 137) $Group4 = GUICtrlCreateGroup(" CPU " , 0, 400, 377, 361) $Group1 = GUICtrlCreateGroup(" GPU " , 384, 400, 345, 361) $Group2 = GUICtrlCreateGroup(" RAM " , 736, 400, 281, 361) $Group3 = GUICtrlCreateGroup(" Motherboard ", 736, 8, 281, 385) $Label1 = GUICtrlCreateLabel("99:99" , 1, 744, 31, 15) $Label3 = GUICtrlCreateLabel("99:99" , 35, 744, 31, 15) $Label2 = GUICtrlCreateLabel("99:99" , 343, 744, 31, 15) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $graph_CPU = GUICreate("", 0, 400, 377, 361, $WS_CHILD, -1, $Form1) GUISetState() $graph_GPU = GUICreate("", 384, 400, 345, 361, $WS_CHILD, -1, $Form1) GUISetState() $graph_RAM = GUICreate("", 736, 400, 281, 361, $WS_CHILD, -1, $Form1) GUISetState() _GDIPlus_Startup () $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($graph_CPU) $hPen = _GDIPlus_PenCreate (0xFFFF0000,5,2) _GDIPlus_GraphicsDrawLine ($hGraphic, 10, 10, 30, 19, $hPen) _GDIPlus_GraphicsDrawLine ($hGraphic, 10, 10, 32, 19, $hPen) _GDIPlus_GraphicsDrawLine ($hGraphic, 10, 10, 38, 19, $hPen) _GDIPlus_PenDispose ($hPen) $hPen = _GDIPlus_PenCreate (0x220000FF,2,2) _GDIPlus_GraphicsDrawLine ($hGraphic, 0, 0, 300, 300, $hPen) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_PenDispose ($hPen) _GDIPlus_GraphicsDispose ($hGraphic) _GDIPlus_Shutdown () Edited February 22, 2012 by pinkfoyd Link to comment Share on other sites More sharing options...
UEZ Posted February 22, 2012 Share Posted February 22, 2012 What do you mean with 4 GDI graphs in one GUI exactly? 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
pinkfoyd Posted February 22, 2012 Author Share Posted February 22, 2012 (edited) Hi UEZ, In my exemple i try just 1 GDI graph, but my goal is to have 4 different graph in my application ( temperature of CPU, GPU,RAM and mother board ) but my first graph does'nt appear, like the child windows was hidden or something like this. for exemple if i change this : $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($graph_CPU) to this : $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($form1) the graph is showing, but in the parent gui, not the child gui Edited February 22, 2012 by pinkfoyd Link to comment Share on other sites More sharing options...
UEZ Posted February 22, 2012 Share Posted February 22, 2012 Try this: expandcollapse popup#include <GUIConstantsEx.au3> ;~ #include <ProgressConstants.au3>;~~~ ;~ #include <StaticConstants.au3>;~~~ ;~ #include <WindowsConstants.au3>;~~~ #include <GDIPlus.au3> #Region ### START Koda GUI section ### Form=h:form1.kxf $Form1 = GUICreate("Form1", 1024, 768, 269, 137) $Group1 = GUICtrlCreateGroup(" GPU " , 384, 400, 345, 361) $PicGPU = GUICtrlCreatePic("", 384, 400, 345, 361) $hPicGPU = GUICtrlGetHandle($PicGPU) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group $Group2 = GUICtrlCreateGroup(" RAM " , 736, 400, 281, 361) $PicRAM = GUICtrlCreatePic("", 736, 400, 281, 361) $hPicRAM = GUICtrlGetHandle($PicRAM) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group $Group3 = GUICtrlCreateGroup(" Motherboard ", 736, 8, 281, 385) $PicMB = GUICtrlCreatePic("", 736, 8, 281, 385) $hPicMB = GUICtrlGetHandle($PicMB) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group $Group4 = GUICtrlCreateGroup(" CPU " , 0, 400, 377, 361) $PicCPU = GUICtrlCreatePic("", 0, 400, 377, 361) $hPicCPU = GUICtrlGetHandle($PicCPU) $Label1 = GUICtrlCreateLabel("99:99" , 1, 744, 31, 15) $Label3 = GUICtrlCreateLabel("99:99" , 35, 744, 31, 15) $Label2 = GUICtrlCreateLabel("99:99" , 343, 744, 31, 15) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUISetState() _GDIPlus_Startup () $hGraphicCPU = _GDIPlus_GraphicsCreateFromHWND ($hPicCPU) $hGraphicGPU = _GDIPlus_GraphicsCreateFromHWND ($hPicGPU) $hGraphicRAM = _GDIPlus_GraphicsCreateFromHWND ($hPicRAM) $hGraphicMB = _GDIPlus_GraphicsCreateFromHWND ($hPicMB) $hPen = _GDIPlus_PenCreate (0xFFFF0000,5,2) _GDIPlus_GraphicsDrawLine ($hGraphicCPU, 10, 10, 30, 19, $hPen) _GDIPlus_GraphicsDrawLine ($hGraphicCPU, 10, 10, 32, 19, $hPen) _GDIPlus_GraphicsDrawLine ($hGraphicCPU, 10, 10, 38, 19, $hPen) _GDIPlus_PenSetColor($hPen, 0x220000FF) _GDIPlus_GraphicsDrawLine ($hGraphicCPU, 10, 10, 300, 300, $hPen) _GDIPlus_PenSetColor($hPen, 0xFF0000FF) _GDIPlus_GraphicsDrawEllipse($hGraphicGPU, 10, 10, 300, 300, $hPen) _GDIPlus_PenSetColor($hPen, 0xFF0FF0FF) _GDIPlus_GraphicsDrawRect($hGraphicRAM, 10, 10, 200, 200, $hPen) _GDIPlus_PenSetColor($hPen, 0xFFFFFF00) _GDIPlus_GraphicsDrawBezier($hGraphicMB, 10, 10, 300, 200, 100, 550, 50, 50, $hPen) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_PenDispose ($hPen) _GDIPlus_GraphicsDispose ($hGraphicCPU) _GDIPlus_GraphicsDispose ($hGraphicGPU) _GDIPlus_GraphicsDispose ($hGraphicRAM) _GDIPlus_GraphicsDispose ($hGraphicMB) _GDIPlus_Shutdown () 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
pinkfoyd Posted February 22, 2012 Author Share Posted February 22, 2012 (edited) You did it, it's exactly what i need Thanks a lot, now will study your trick EDIT : nice one, never have idea to use the GUICtrlCreatePic ^^ Edited February 22, 2012 by pinkfoyd 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