Miliardsto Posted January 10, 2018 Share Posted January 10, 2018 (edited) Hello I have problem with my object drawn in gdi expandcollapse popupFunc drawTriangle($tabName,$gui_active = 0) _GDIPlus_Startup() ;initialize GDI+ Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($sGUI[$gui_active]) ;create a graphics object from a window handle _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;sets the graphics object rendering quality (antialiasing) Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFEFEFEF) ;color format AARRGGBB (hex) Local $aPoints[5][3] $aPoints[0][0] = 4 $aPoints[1][0] = 0.0 ; left $aPoints[1][1] = 0.0 ; top $aPoints[2][0] = 0.0 ; left $aPoints[2][1] = 30.0 ; top $aPoints[3][0] = 80.0 ; left $aPoints[3][1] = 30.0 ; top $aPoints[4][0] = 110.0 ; left $aPoints[4][1] = 0.0 ; top _GDIPlus_GraphicsFillPolygon($hGraphics, $aPoints, $hBrush) ;draw the triangle Local $fBrush = _GDIPlus_BrushCreateSolid(0xFFAAAAAA) ;color format AARRGGBB (hex) Local $sString = $tabName, $aInfo ; from the func param Local $hFormat, $hFamily, $hFont, $tLayout $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Segoe UI") $hFont = _GDIPlus_FontCreate($hFamily, 12, 2) $tLayout = _GDIPlus_RectFCreate(6, 2) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $sString, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hGraphics, $sString, $hFont, $aInfo[0], $hFormat, $fBrush) ;_GDIPlus_GraphicsDrawString($hGraphics, $tabName, 6, 3, "Segoe UI", 12) ; write text ;cleanup GDI+ resources _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() EndFunc After this code execution I got new object rectangle Global $ma_border = GUICtrlCreateGraphic(100, 180, 40, 40) GUICtrlSetGraphic($ma_border, $GUI_GR_COLOR, 0x00000, $COLOR_BLUE) GUICtrlSetGraphic($ma_border, $GUI_GR_RECT, 0, 0, 40, 40) GUICtrlSetState(-1,$GUI_DISABLE) And what happens is first func = draw rectangle is pushed to parameters from GUICtrlCreateGraphic func. Left: 100, Top: 180. I can simplu reverse order of these func execution but There is too much things to change in my code. Can something be done to prevent this slipping? Edited January 10, 2018 by Miliardsto 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