Jump to content

..


Recommended Posts

Problem seems to be fixed by creating the graphics before showing the GUI. For example this works, just by switching the order of two lines:

#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>

If Not _GDIPlus_Startup() Then Exit
_Main()
_GDIPlus_Shutdown()

Func _Main()
    ; Create GUI 1
    Local $h_GUI_1 = GUICreate("GUI without Graphic", 200, 600, 200)
    GUISetState()
    Local $h_Graphics = _GDIPlus_GraphicsCreateFromHWND($h_GUI_1)
    _GDIPlus_GraphicsDrawLine($h_Graphics, 0, 250, 200, 250)
    _GDIPlus_GraphicsDispose($h_Graphics)
    ; Create GUI 2
    Local $h_GUI_2 = GUICreate("GUI with Graphic", 200, 600, 450)
    GUICtrlCreateGraphic(10, 100, 56, 56)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x0000FF, 0x0000FF)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 28, 28, 27, 90, 360)
    $h_Graphics = _GDIPlus_GraphicsCreateFromHWND($h_GUI_2) ; <<<<<<< Moved this line before GUISetState
    GUISetState()
    _GDIPlus_GraphicsDrawLine($h_Graphics, 0, 250, 200, 250)
    _GDIPlus_GraphicsDispose($h_Graphics)
    While 1
        If GUIGetMsg() = -3 Then ExitLoop
    WEnd
EndFunc

But no, that is most strange and I would not expect it. You might get an answer as to why if you are lucky, but I don't think its anything to do with AutoIt.

Edit: Actually it works like this too:

#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#include <GUIConstantsEx.au3>
#include <GDIPlus.au3>

If Not _GDIPlus_Startup() Then Exit
_Main()
_GDIPlus_Shutdown()

Func _Main()
    ; Create GUI 1
    Local $h_GUI_1 = GUICreate("GUI without Graphic", 200, 600, 200)
    GUISetState()
    Local $h_Graphics = _GDIPlus_GraphicsCreateFromHWND($h_GUI_1)
    _GDIPlus_GraphicsDrawLine($h_Graphics, 0, 250, 200, 250)
    _GDIPlus_GraphicsDispose($h_Graphics)
    ; Create GUI 2
    Local $h_GUI_2 = GUICreate("GUI with Graphic", 200, 600, 450)
    $h_Graphics = _GDIPlus_GraphicsCreateFromHWND($h_GUI_2)
    GUICtrlCreateGraphic(10, 100, 56, 56)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x0000FF, 0x0000FF)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 28, 28, 27, 90, 360)
    GUISetState()
    _GDIPlus_GraphicsDrawLine($h_Graphics, 0, 250, 200, 250)
    _GDIPlus_GraphicsDispose($h_Graphics)
    While 1
        If GUIGetMsg() = -3 Then ExitLoop
    WEnd
EndFunc
Edited by Mat
Link to comment
Share on other sites

I don't know why this happens but you can use this way:

...
    GUICtrlCreateGraphic(0, 0, 200, 600)
    GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x0000FF, 0x0000FF)
    GUICtrlSetGraphic(-1, $GUI_GR_PIE, 38, 100, 27, 90, 360)
...

Btw, why are you mixing the graphic elements?

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...