Jump to content

Save Label Area to PNG


Tony007
 Share

Recommended Posts

Hi,

is it possible to export only the area "$idOutput" with the TEXT as a PNG?

Thanks

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>

Example()

Func Example()
      Local $hGUI = GUICreate("Test", 700, 700, -1, -1)

      Local $input1 = GUICtrlCreateInput("", 10, 10, 150, 20)

      Local $idButtonStart = GUICtrlCreateButton("Start", 200, 10, 50, 30)
      Local $idButtonClear = GUICtrlCreateButton("Clear", 260, 10, 50, 30)
      Local $idButtonExport = GUICtrlCreateButton("Export", 320, 10, 50, 30)

      Local $idOutput = GUICtrlCreateLabel("TEXT", 10, 50, 500, 500, BitOR($BS_PUSHLIKE, $SS_CENTER))
      GUICtrlSetFont($idOutput, 45, 800, "", "Impact")

      GUISetState(@SW_SHOW, $hGUI)

    ; Run the GUI until the dialog is closed
      While 1
         Switch GUIGetMsg()
               Case $GUI_EVENT_CLOSE
                  ExitLoop

               Case $idButtonStart
                  $ContentInput1 = GUICtrlRead($input1)
                  GUICtrlSetData($idOutput, $ContentInput1)

               Case $idButtonClear
                  GUICtrlSetData($input1, "")
                  GUICtrlSetData($idOutput, "")

               Case $idButtonExport


         EndSwitch
      WEnd
      GUIDelete($hGUI)
      Exit
EndFunc   ;==>Example

 

Link to comment
Share on other sites

Case $idButtonExport
        $tRect = _WinAPI_GetWindowRect (ControlGetHandle($hGUI, "", $idOutput))
        $iLeft = DllStructGetData ($tRect,"left")
        $iTop = DllStructGetData ($tRect,"top")
        $iRight = DllStructGetData ($tRect,"right")
        $iBottom = DllStructGetData ($tRect,"bottom")
        _ScreenCapture_Capture ("Test.png",$iLeft, $iTop, $iRight, $iBottom)

 

Edited by Nine
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

×
×
  • Create New...