When a GUI contains a graphic control created by GUICtrlCreateGraphic, all GDI+ graphics are drawn relative to the upper left corner of the graphic control.
This example script demonstrates the issue. The line in the second GUI is shifted 10 pixels to the right and 100 pixels down from its expected location which corresponds to the upper left corner of the graphic control.
Is this supposed to happen?
Here's a pic that demonstrates the code output.
This example script demonstrates the issue. The line in the second GUI is shifted 10 pixels to the right and 100 pixels down from its expected location which corresponds to the upper left corner of the graphic control.
Is this supposed to happen?
[ autoit ]
#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) GUISetState() $h_Graphics = _GDIPlus_GraphicsCreateFromHWND($h_GUI_2) _GDIPlus_GraphicsDrawLine($h_Graphics, 0, 250, 200, 250) _GDIPlus_GraphicsDispose($h_Graphics) While 1 If GUIGetMsg() = -3 Then ExitLoop WEnd EndFunc
Here's a pic that demonstrates the code output.