Jump to content

Recommended Posts

Posted (edited)

i have a code that creates buttons and graphics in the same block.  before the block is _GDIPlus_Startup()

$hGraphic = _GDIPlus_GraphicsCreateFromHWND($mainGUI)

        $hBrush = _GDIPlus_BrushCreateSolid(0xF03FC744) ; Felish Green colour
        $hPen = _GDIPlus_PenCreate(0xFFBFCC49); Granite colour
        $hPath = _GDIPlus_PathCreate() ;Create new path object
        $hFamily = _GDIPlus_FontFamilyCreate("Tahoma") ;Create font family object

        $tLayout = _GDIPlus_RectFCreate($startX, $startY, $bHeigh, $bWidth) ;Create string bounding rectangle X=0, Y=0
        $hFormat = _GDIPlus_StringFormatCreate(0x0400); Allow overhanging rectangle
        _GDIPlus_StringFormatSetAlign($hFormat, 1); Align text horizontally
        _GDIPlus_StringFormatSetLineAlign($hFormat, 1) ; Align text Vertically

        ; Add String like CtrlLabels assign to rectangle and formats including Font _
        _GDIPlus_PathAddString($hPath, FileReadLine($configF, $SN), $tLayout, $hFamily, 0, 26, $hFormat)

        _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;Sets the graphics object rendering quality (antialiasing)
        _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ; Fill path to graphics handle (GUI)

end of the block

_GDIPlus_BrushDispose($hBrush)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()

now this works on the first run but when i minimize and then restore _GDIPlus_ is gone and so are buttons. but if i create labels they stay.

i've tried moving "Dispose" functions at the end of the loop but still the same result

 

Edited by shotiko

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
×
×
  • Create New...