Jump to content

Odd problem with string placement over image


Burgs
 Share

Recommended Posts

#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <ButtonConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <GDIPlus.au3>
#include <TabConstants.au3>
#include <MsgBoxConstants.au3>
#include <Misc.au3>
#include <ScreenCapture.au3>

AutoItSetOption("GUIOnEventMode", 1)
AutoItSetOption("MustDeclareVars", 1)

 Global $_Line1_SETS[5] = [-1, -1, -1, -1, -1], $_Line2_SETS[5] = [-1, -1, -1, -1, -1]
   ;record the 'FONT SELECTIONS' for 'TEXT' placements
 Global $_XPOS_SETS[4] = [-1, -1, -1, -1], $_YPOS_SETS[4] = [-1, -1, -1, -1]
   ;record the X, Y PLOTS for watermark 'IMAGE' AND 'TEXT' placements
 Global $_TXT_SETS[3] = [-1, -1, -1]
   ;record the STRING setting for 'TEXT' placements

 ;**VARIABLES RELATING TO GRAPHICS...
 Global $_SAVED_SLOTS[1], $_SECOND_SLOTS = -1, $_IMAGE_BACK
 Global $_MOUSE_LOCATE, $_MOUSE_LOCATE_X, $_MOUSE_LOCATE_Y, $_MOUSE_HOVER, $tRECT, $iTitleHeight, $iBorderWidth, $iBorderHeight
 Global $hFamily, $hFont, $tLayout, $hFormat, $aInfo, $hBrush1, $hBrush2, $iWidth, $iHeight, $iWidth2, $iHeight2, $hPen, $_VERT_TXT1, $_VERT_TXT2
 Global $hImage, $hImage2, $hImage3, $hBitmap, $hBitmap2, $hHBITMAP, $_External_Height, $_External_Width, $_IMAGE_PATHS[2], $_MOUNT_BACK, $_WinPOS

 ;**OTHER VARIABLES
 Global $_Outside_Load, $Primary_TXT, $Secondary_TXT, $_OPACITY_TXT, $_Line1, $_Line2, $font = "Arial", $slider1, $_COPY_CONFIRM = -1, $_INIT_MAIN
 Global $_IMG_POS, $_Line1_POS, $_Line2_POS
 Global $_MAIN_MOUSE_ID, $hFocus, $sControl, $hHandle, $_TAB_IN = -1, $_TAB_OUT = -1, $_FIRST_ROUND = 1, $sString, $a_font, $_Past_Pass = 0, $_BLANKS = 0
 Global $_CTRL_GUI, $_CTRL_SELECT = -1, $_ADJUST_SLOTS = -1, $_CONTROL_HWD, $_THE_MOUSE, $_GUI_WIDTH = 768, $_GUI_HEIGHT = 689

 Global $hDLL = DllOpen("user32.dll")
 
  $_SAVED_SLOTS[0] = -1  ;default
 $_IMAGE_PATHS[0] = @ScriptDir & "\sample_com.png"
 $_IMAGE_PATHS[1] = @ScriptDir & "\back_reference3.jpg"

 Global $MainGUI = GUICreate("Main Window", $_GUI_WIDTH, $_GUI_HEIGHT)
 GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")

 GUISetState(@SW_SHOW)
 
  $Primary_TXT = GUICtrlCreateLabel("'Upper' Text Line", 80, 124, 80, 20, BitOr($GUI_SS_DEFAULT_LABEL, $SS_LEFT), -1)
 GUICtrlSetBkColor($Primary_TXT, $GUI_BKCOLOR_TRANSPARENT)
 GUICtrlSetFont($Primary_TXT, 8.5, 400, 1, $font)
 GUICtrlSetState($Primary_TXT, $GUI_SHOW)
 $Secondary_TXT = GUICtrlCreateLabel("'Lower' Text Line", 80, 189, 85, 20, BitOr($GUI_SS_DEFAULT_LABEL, $SS_LEFT), -1)
 GUICtrlSetBkColor($Secondary_TXT, $GUI_BKCOLOR_TRANSPARENT)
 GUICtrlSetFont($Secondary_TXT, 8.5, 400, 1, $font)
 GUICtrlSetState($Secondary_TXT, $GUI_SHOW)
 $_IMG_POS = GUICtrlCreateLabel("'Image' position is NOT set", 80, 90, 150, 20, BitOr($GUI_SS_DEFAULT_LABEL, $SS_LEFT), -1)
 GUICtrlSetBkColor($_IMG_POS, $GUI_BKCOLOR_TRANSPARENT)
 GUICtrlSetFont($_IMG_POS, 7.5, 400, 1, $font)
 GUICtrlSetState($_IMG_POS, $GUI_DISABLE)
 GUICtrlSetState($_IMG_POS, $GUI_SHOW)
 $_Line1_POS = GUICtrlCreateLabel("'Upper' Text position is NOT set", 80, 161, 150, 20, BitOr($GUI_SS_DEFAULT_LABEL, $SS_LEFT), -1)
 GUICtrlSetBkColor($_Line1_POS, $GUI_BKCOLOR_TRANSPARENT)
 GUICtrlSetFont($_Line1_POS, 7.5, 400, 1, $font)
 GUICtrlSetState($_Line1_POS, $GUI_DISABLE)
 GUICtrlSetState($_Line1_POS, $GUI_SHOW)
 $_Line2_POS = GUICtrlCreateLabel("'Lower' Text position is NOT set", 80, 226, 150, 20, BitOr($GUI_SS_DEFAULT_LABEL, $SS_LEFT), -1)
 GUICtrlSetBkColor($_Line2_POS, $GUI_BKCOLOR_TRANSPARENT)
 GUICtrlSetFont($_Line2_POS, 7.5, 400, 1, $font)
 GUICtrlSetState($_Line2_POS, $GUI_DISABLE)
 GUICtrlSetState($_Line2_POS, $GUI_SHOW)


 $_Outside_Load = GUICtrlCreateRadio("Image from file", 85, 74, 150, 20)
 GUICtrlSetState($_Outside_Load, $GUI_ENABLE)
 GUICtrlSetState($_Outside_Load, $GUI_SHOW)
 GUICtrlSetState($_Outside_Load, $GUI_UNCHECKED)

 $_Line1 = GUICtrlCreateInput("", 80, 140, 50, 20, $ES_LEFT)
 GUICtrlSetData($_Line1, "example")
 GUICtrlSetState($_Line1, $GUI_ENABLE)
 GUICtrlSetState($_Line1, $GUI_SHOW)
 $_Line2 = GUICtrlCreateInput("", 80, 205, 50, 20, $ES_LEFT)
 GUICtrlSetData($_Line2, "text")
 GUICtrlSetState($_Line2, $GUI_ENABLE)
 GUICtrlSetState($_Line2, $GUI_SHOW)

 $_VERT_TXT1 = GUICtrlCreateCheckbox("Vertical Text", 435, 130, 100, 20)
 GUICtrlSetState($_VERT_TXT1, $GUI_DISABLE)
 GUICtrlSetState($_VERT_TXT1, $GUI_HIDE)
 GUICtrlSetState($_VERT_TXT1, $GUI_UNCHECKED)

 $_VERT_TXT2 = GUICtrlCreateCheckbox("Vertical Text", 435, 200, 100, 20)
 GUICtrlSetState($_VERT_TXT2, $GUI_DISABLE)
 GUICtrlSetState($_VERT_TXT2, $GUI_HIDE)
 GUICtrlSetState($_VERT_TXT2, $GUI_UNCHECKED)

 ;**"IMAGE CONTROLS"...

 $_OPACITY_TXT = GUICtrlCreateLabel("Opacity:", 80, 423, 75, 20, BitOr($GUI_SS_DEFAULT_LABEL, $SS_LEFT), -1)
 GUICtrlSetBkColor($_OPACITY_TXT, $GUI_BKCOLOR_TRANSPARENT)
 GUICtrlSetFont($_OPACITY_TXT, 8.5, 400, 0, $font)
 GUICtrlSetState($_OPACITY_TXT, $GUI_ENABLE)
 GUICtrlSetState($_OPACITY_TXT, $GUI_HIDE)

 $slider1 = GUICtrlCreateSlider(80, 439, 200, 20)
 GUICtrlSetLimit($slider1, 100, 0) ;change min/max value
 GUICtrlSetData($slider1, 100) ;set cursor
 GUICtrlSetState($slider1, $GUI_HIDE)

 ;**
 
 _GDIPlus_Startup()
 
  GUISwitch($MainGUI)

Main()

Func Main()

    While 1

        ; Sleep because GUIOnEventMode is NOT a blocking function like GUIGetMsg
        Sleep(10)

      $_MAIN_MOUSE_ID = GUIGetCursorInfo($MainGUI)

       if IsArray($_MAIN_MOUSE_ID) == 1 Then
       $_MAIN_MOUSE_ID = $_MAIN_MOUSE_ID[4]
       $hHandle = ControlGetHandle($MainGUI, "", $_MAIN_MOUSE_ID)

        if _IsPressed("01", $hDLL) Then  ; _IsPressed("0D", $hDLL) OR _IsPressed("09", $hDLL) OR

         ; Wait until key is released.
         if _IsPressed("01", $hDLL) Then
         $sControl = _IsPressed("01", $hDLL)
         EndIf  ;_IsPressed is "01"...left mouse click...

          While _IsPressed($sControl, $hDLL)
          Sleep(250)
          WEnd

        ;**STORE THE LAST HANDLE THAT WAS NOT THE 'TAB CONTROL'...!
        $_Past_Pass = $hFocus

        $sControl = ControlGetFocus($MainGUI)
        $hFocus = ControlGetHandle($MainGUI, "", $sControl)
          ;place focus on the control 'hovered' over...since this ocurrs the instant of a 'left-click', 'ENTER', OR
          ;'TAB' this MUST be what control the cursor is currently placed within...!!!!

        $_TAB_OUT = $_TAB_IN  ;save the handle to the 'last TABBED' control
                              ;(the field control from where the TAB was made from)...if applicable
        $_TAB_IN = $hFocus  ;the control with keyboard focus is set as '$_TAB_IN'

       ;**

         if $hHandle == GUICtrlGetHandle($_Outside_Load) Then
         $_CTRL_SELECT = 0
         GUICtrlSetState($_Outside_Load, $GUI_DISABLE)
         GUICtrlSetState($_Outside_Load, $GUI_CHECKED)

                   if (Number($_FIRST_ROUND) == 1) Then
                   CONTROL_GUI()
                   Else
                   REDRAW_GUI()
                   EndIf  ;show the 'POSITIONING GUI'...depending
                          ;on 'first usage'...IF NOT, then the
                          ;'POSITIONING GUI' will need to be
                          ;re-drawn to account for the 'new'
                          ;positioning activity the user wishes...

         EndIf  ;'$_Outside_Load' was clicked...

        EndIf  ;make sensitivity to 'LEFT' mouse clicks...

        if _IsPressed("0D", $hDLL) OR _IsPressed("09", $hDLL) Then

         ;Wait until key is released.
         if _IsPressed("0D", $hDLL) Then
         $sControl = _IsPressed("0D", $hDLL)
         EndIf  ;'Enter' pressed...
         if _IsPressed("09", $hDLL) Then
         $sControl = _IsPressed("09", $hDLL)
         EndIf  ;'TAB' pressed...

          While _IsPressed($sControl, $hDLL)
          Sleep(250)
          WEnd

        ;**STORE THE LAST HANDLE THAT WAS NOT THE 'TAB CONTROL'...!
        $_Past_Pass = $hFocus

        $sControl = ControlGetFocus($MainGUI)
        $hFocus = ControlGetHandle($MainGUI, "", $sControl)
          ;place focus on the 'proper' control...since this ocurrs the instant of a 'ENTER', OR
          ;'TAB' this MUST be what control the cursor is currently placed within...!!!!

        $_TAB_OUT = $_TAB_IN  ;save the handle to the 'last TABBED' control
                              ;(the field control from where the TAB was made from)...if applicable
        $_TAB_IN = $hFocus  ;the control with keyboard focus is set as '$_TAB_IN'

        $hHandle = ControlGetHandle($MainGUI, "", $hFocus)
        ;**


            if ($hFocus == GUICtrlGetHandle($_Line1)) OR ($_Past_Pass == GUICtrlGetHandle($_Line1)) OR ($hFocus == GUICtrlGetHandle($_Line2)) OR ($_Past_Pass == GUICtrlGetHandle($_Line2)) Then

             $_BLANKS = 0  ;default

              if ($hFocus == GUICtrlGetHandle($_Line1)) OR ($_Past_Pass == GUICtrlGetHandle($_Line1)) Then $sString = String(GUICtrlRead($_Line1))
              if ($hFocus == GUICtrlGetHandle($_Line2)) OR ($_Past_Pass == GUICtrlGetHandle($_Line2)) Then $sString = String(GUICtrlRead($_Line2))

              if StringIsSpace($sString) Then
              MsgBox(64, "Error: Missing Required Info", "The variable contains only whitespace characters.")
              $_BLANKS = 1
              Else
               if (($hFocus == GUICtrlGetHandle($_Line1)) OR ($_Past_Pass == GUICtrlGetHandle($_Line1))) AND (StringLen(String(GUICtrlRead($_Line1))) == 0) Then
               MsgBox(64, "Error: Missing Required Info", "Only legitimate characters are required for text elements...")
               $_BLANKS = 1
               EndIf  ;'$_Line1' does NOT contain any characters...
               if (($hFocus == GUICtrlGetHandle($_Line2)) OR ($_Past_Pass == GUICtrlGetHandle($_Line2))) AND (StringLen(String(GUICtrlRead($_Line2))) == 0) Then
               MsgBox(64, "Error: Missing Required Info", "Only legitimate characters are required for text elements...")
               $_BLANKS = 1
               EndIf  ;'$_Line2' does NOT contain any characters...


               if Number($_BLANKS) == 0 Then
               $a_font = _ChooseFont()

                if @error <> 0 Then
                MsgBox(4096, "", "No File(s) chosen")
                Else
                MsgBox(64, "Font Selections", "Font Name: " & $a_font[2] & @CRLF & "Size: " & $a_font[3] & @CRLF & "Weight: " & $a_font[4] & @CRLF & "COLORREF rgbColors: " & $a_font[5] & @CRLF & "Hex BGR Color: " & $a_font[6] & @CRLF & "Hex RGB Color: " & $a_font[7])
                 if (($hFocus == GUICtrlGetHandle($_Line1)) OR ($_Past_Pass == GUICtrlGetHandle($_Line1))) Then
                 $_CTRL_SELECT = 1
                 $_TXT_SETS[0] = $sString
                 $_Line1_SETS[0] = $a_font[2]
                 $_Line1_SETS[1] = $a_font[3]
                 $_Line1_SETS[2] = $a_font[4]
                 $_Line1_SETS[3] = $a_font[7]
                 $_Line1_SETS[4] = $a_font[1]
                 EndIf  ;"$_Line1"
                 if (($hFocus == GUICtrlGetHandle($_Line2)) OR ($_Past_Pass == GUICtrlGetHandle($_Line2))) Then
                 $_CTRL_SELECT = 2
                 $_TXT_SETS[1] = $sString
                 $_Line2_SETS[0] = $a_font[2]
                 $_Line2_SETS[1] = $a_font[3]
                 $_Line2_SETS[2] = $a_font[4]
                 $_Line2_SETS[3] = $a_font[7]
                 $_Line2_SETS[4] = $a_font[1]
                 EndIf  ;"$_Line2"

                   if (Number($_FIRST_ROUND) == 1) Then
                   CONTROL_GUI()
                   Else
                   REDRAW_GUI()
                   EndIf  ;show the 'POSITIONING GUI'...depending
                          ;on 'first usage'...IF NOT, then the
                          ;'POSITIONING GUI' will need to be
                          ;re-drawn to account for the 'new'
                          ;positioning activity the user wishes...

                EndIf  ;@error set when accessing 'font dialog'...OR NOT...

               EndIf  ;'$_BLANKS' IS "0"...OK to present the 'font' dialog...
              EndIf  ;'$sString' contains ONLY whitespace characters...OR NOT...

            EndIf  ;'$_Line1' OR '$_Line2' was clicked...the InputBox Controls for "TEXTs"...


        EndIf  ;make sensitivity to 'Enter' OR 'TAB' presses...

       EndIf  ;IsArray($_MAIN_MOUSE_ID) is 1 ($_MAIN_MOUSE_ID IS an array...)

    WEnd
EndFunc

;////////////////////////

Func CONTROL_GUI()

   ;****CREATE THE GUI...

      $hImage = _GDIPlus_ImageLoadFromFile($_IMAGE_PATHS[1])
      $_MOUNT_BACK = String($_IMAGE_PATHS[1])  ;save the initial background image used...

           $_External_Height = _GDIPlus_ImageGetHeight($hImage)
           $_External_Width = _GDIPlus_ImageGetWidth($hImage)

   $_CTRL_GUI = GUICreate("Positioning", Number($_External_Width), Number($_External_Height), -1, -1, BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU, $WS_EX_TOPMOST))
   GUISetBkColor(0xFFFFFF)  ;set GUI background to 'White'...

 GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

   GUISetState(@SW_SHOW, $_CTRL_GUI)

   $_CONTROL_HWD = WinGetHandle($_CTRL_GUI)  ;save the handle to the Window...

    ;****
    if WinExists($_CONTROL_HWD) Then

    Global $_adjusts = _GDIPlus_GraphicsCreateFromHWND($_CTRL_GUI)
    Global $hBmp_Buffer = _GDIPlus_BitmapCreateFromGraphics($_External_Width, $_External_Height, $_adjusts)
    Global $hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext($hBmp_Buffer)

    Global $hImage3 = _GDIPlus_ImageLoadFromFile($_IMAGE_PATHS[0])  ;create the (WaterMark) image...

    Global $iMouseX, $iMouseY

     GUIRegisterMsg($WM_LBUTTONDOWN, "WM_LBUTTONDOWN")
     GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL")
     GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")
     GUIRegisterMsg($WM_LBUTTONUP, "_POSITION_TRAX")

     _Draw()

      While Number($_CONTROL_HWD) <> -1
      Sleep(10)
      WEnd

     ;**'UNREGISTER'...
     GUIRegisterMsg($WM_LBUTTONDOWN, "")
     GUIRegisterMsg($WM_MOUSEWHEEL, "")
     GUIRegisterMsg($WM_MOUSEMOVE, "")
     GUIRegisterMsg($WM_LBUTTONUP, "")
     ;**

    EndIf  ;WinExists ($_CONTROL_HWD)...
    ;****

EndFunc  ;"CONTROL_GUI()"

Func REDRAW_GUI()

 Global $_SAVED_SLOTS[1]  ;re-declare to 'clear-out' array...
 Local $_REMOVE_SLOTS[1], $_verify_SLOT, $_GUI_IMG = _GDIPlus_ImageLoadFromFile($_IMAGE_PATHS[0])  ;create the (WaterMark) image...
 Local $_source, $_Scan_Files, $_Num_Files, $_Search, $iReplacements, $_WORKING_FILE, $_SAVE_SELECT, $_MASTER_SWITCH = 1

 $_SAVED_SLOTS[0] = -1  ;default
 $_REMOVE_SLOTS[0] = -1  ;default
 $_IMAGE_BACK = -1  ;default
;ConsoleWrite(" INITIAL '$_CTRL_SELECT' is: " & Number($_CTRL_SELECT) & @CRLF)
          For $_RIGGING = 0 to Ubound($_XPOS_SETS) - 1
          $_verify_SLOT = -1  ;default EACH ITERATION...

           if Number($_RIGGING) <> Number($_CTRL_SELECT) Then
            if (Number($_XPOS_SETS[Number($_RIGGING)]) >= 0) AND (Number($_YPOS_SETS[Number($_RIGGING)]) >= 0) Then

             if (Number($_RIGGING) == 0) AND ($_GUI_IMG <> 0) Then $_verify_SLOT = 1
             if (Number($_RIGGING) == 1) AND (IsString(GUICtrlRead($_Line1)) == 1) AND (StringLen(String(GUICtrlRead($_Line1))) > 0) Then $_verify_SLOT = 1
             if (Number($_RIGGING) == 2) AND (IsString(GUICtrlRead($_Line2)) == 1) AND (StringLen(String(GUICtrlRead($_Line2))) > 0) Then $_verify_SLOT = 1

              if Number($_verify_SLOT) <> -1 Then
               if $_SAVED_SLOTS[0] <> -1 Then _ArrayAdd($_SAVED_SLOTS, Number($_RIGGING))
               if $_SAVED_SLOTS[0] == -1 Then $_SAVED_SLOTS[0] = Number($_RIGGING)
              EndIf  ;'$_verify_SLOT' NOT "-1"...indicates an 'element' to be 'REDRAWN'...

            EndIf  ;'$_XPOS_SETS' AND '$_YPOS_SETS' >= "0"...valid 'position' locations are set...
           EndIf  ;'$_RIGGING' does NOT equal '$_CTRL_SELECT'...
                  ;re-create this Control in its previously set
                  ;location...!

          Next  ;Next $_RIGGING, cycle thru all 'CONTROLS' so as to 'REDRAW'
                ;in their proper locations those NOT affected by the 'REPOSITIONING'


   ;****DETERMINE IF A 'SLOT' IMAGE IS EXTANT...

           if Number($_SAVED_SLOTS[0]) <> -1 Then
           $hImage = -1  ;default
           $_Num_Files = -1  ;default
           $_Scan_Files = 0  ;re-assign to 'free' array...

           $_Search = _ArrayToString($_SAVED_SLOTS, "-")

           $_source = FileFindFirstFile(@ScriptDir & "\_Outputs\_Slots\*.jpg")
           $_Scan_Files = DirGetSize(@ScriptDir & "\_Outputs\_Slots", $DIR_EXTENDED)

            if (Number($_Scan_Files) == -1) OR (IsArray($_Scan_Files) <> 1) Then MsgBox(64, "Directory Error:", "Problem reading desired Directory for '$_Scan_Files'...error: " & @error)
            if (Number($_Scan_Files) <> -1) AND (IsArray($_Scan_Files) == 1) Then $_Num_Files = $_Scan_Files[1]  ;set the # of FILES in the searched Directory...

             if Int($_Num_Files) >= 1 Then

              For $_RIGGING = 1 to Int($_Num_Files)
              $_WORKING_FILE = FileFindNextFile($_source)  ;returns a FileName...(i.e. "@ScriptDir & "\_Outputs\_Slots\XXX.jpg")

               if Number(StringInStr(String($_WORKING_FILE), String($_Search), $STR_NOCASESENSE)) <> 0 Then
                if StringCompare(String($_WORKING_FILE), String("Slot_Image" & $_Search & ".jpg"), $STR_NOCASESENSE) == 0 Then
                $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\_Outputs\_Slots\" & String($_WORKING_FILE))
                  ;load the 'SLOT' image file that contains needed 'elements'...

                EndIf  ;'$_WORKING_FILE' AND '$_Search' are equal 'STRINGs'...
               EndIf  ;'$_Search' has been located embedded within '$_WORKING_FILE' FileName...this image
                      ;name MIGHT 'match' the image background to be loaded...
              Next  ;Next $_RIGGING (search all the files in the '_Slots' Folder to find Directories and .jpg files

             EndIf  ;$_Num_Files >= 1 (search through multiple FOLDERS)...

           ; Close the search handle.
           FileClose($_source)
           EndIf  ;'$_SAVED_SLOTS[0]' NOT "-1"...'elements' have been determined...

           if Number($hImage) == -1 Then
           $_MASTER_SWITCH = -1
           $hImage = _GDIPlus_ImageLoadFromFile($_MOUNT_BACK)  ;use '$_MOUNT_BACK'...to load the originaly selected 'IMAGE' file...
           EndIf  ;'$hImage' is "-1"...a 'SLOT' image to use for a background
                  ;has NOT been located...need to attempt to re-create by
                  ;calling "_Draw()"...
   ;****

   ;****CREATE THE 'BACKGROUND' IMAGE FOR USE IN THE GUI...

                $_External_Height = _GDIPlus_ImageGetHeight($hImage)
                $_External_Width = _GDIPlus_ImageGetWidth($hImage)

   ;****CREATE THE GUI...

   $_CTRL_GUI = GUICreate("Positioning", Number($_External_Width), Number($_External_Height), -1, -1, BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU, $WS_EX_TOPMOST))
   GUISetBkColor(0xFFFFFF)  ;set GUI background to 'White'...

   GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

   GUISetState(@SW_SHOW, $_CTRL_GUI)

   $_CONTROL_HWD = WinGetHandle($_CTRL_GUI)  ;save the handle to the Window...

   ;****INITIALIZE NEEDED VARIABLES FOR THE GUI...

    Global $_adjusts = _GDIPlus_GraphicsCreateFromHWND($_CTRL_GUI)
    Global $hBmp_Buffer = _GDIPlus_BitmapCreateFromGraphics($_External_Width, $_External_Height, $_adjusts)
    Global $hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext($hBmp_Buffer)

    Global $hImage3 = _GDIPlus_ImageLoadFromFile($_IMAGE_PATHS[0])  ;create the (WaterMark) image...

    Global $iMouseX, $iMouseY


    if Number($_MASTER_SWITCH) <> 1 Then

    $_SAVE_SELECT = $_CTRL_SELECT
      ;store the '$_CTRL_SELECT' variable for future usage since the '_Exit'
      ;function will clear the value...

    $_IMAGE_BACK = -1  ;default

           if Number($_SAVED_SLOTS[0]) <> -1 Then
;ConsoleWrite(" INITIAL '$_SAVED_SLOTS' is: " & _ArrayToString($_SAVED_SLOTS, ",") & @CRLF)

            For $_i = 0 to Ubound($_SAVED_SLOTS) - 1

             if FileExists(@ScriptDir & "\_Outputs\_Slots\" & String("Slot_Image" & String($_SAVED_SLOTS[$_i]) & ".jpg")) == 1 Then
              if $_REMOVE_SLOTS[0] <> -1 Then _ArrayAdd($_REMOVE_SLOTS, Number($_SAVED_SLOTS[$_i]))
              if $_REMOVE_SLOTS[0] == -1 Then $_REMOVE_SLOTS[0] = Number($_SAVED_SLOTS[$_i])

              if Number($_IMAGE_BACK) == -1 Then $_IMAGE_BACK = @ScriptDir & "\_Outputs\_Slots\" & String("Slot_Image" & String($_SAVED_SLOTS[$_i]) & ".jpg")
                ;'$_IMAGE_BACK' will populate a 'STRING' value on the 'first' file
                ;that is to be removed from the '$_SAVED_SLOTS' array...
             EndIf  ;an image in 'SLOTS' equals the name corresponding to the
                    ;variable in the '$_SAVED_SLOTS' array...remove it from the array...
                    ; ALSO save the 'first' file (since it MUST have the most minimal
                    ;index offset element) for usage as a 'background' image...

            Next  ;Next $_i, cycle thru '$_SAVED_SLOTS', which SHOULD
                  ;contain the 'elements' needed to be re-drawn...to remove
                  ;'EXTANT' image file(s) when necessary...
;_ArrayDisplay($_REMOVE_SLOTS)
             if Number($_REMOVE_SLOTS[0]) <> -1 Then

              For $_j = 0 to Ubound($_REMOVE_SLOTS) - 1

              _ArrayDelete($_SAVED_SLOTS, Int(_ArraySearch($_SAVED_SLOTS, Int($_REMOVE_SLOTS[$_j]))))

               if @error == 0 Then
ConsoleWrite(" VALUE OF: " & Int($_REMOVE_SLOTS[$_j]) & " WAS DELETED FROM '$_SAVED_SLOTS' ARRAY..." & @CRLF)
               EndIf  ;@error is "0"..._ArrayDelete was accomplished...

              Next  ;Next $_j, cycle thru 'REMOVE_SLOTS' to delete required indices...

             EndIf  ;'$_REMOVE_SLOTS[0]' is NOT "-1"

            ;**

           EndIf  ;'$_SAVED_SLOTS[0]' NOT "-1"

     ;**ENSURE IF '$_SAVED_SLOTS' IS NOT AN 'EMPTY' ARRAY...

      if Ubound($_SAVED_SLOTS) <= 0 Then

      ;****CREATE THE 'BACKGROUND' IMAGE FOR USE IN THE GUI...

        if Number($_IMAGE_BACK) <> -1 Then
        $hImage = _GDIPlus_ImageLoadFromFile($_IMAGE_BACK)
          ;'$_IMAGE_BACK' WILL BE SET AS THE 'LAST' RE-DRAWN IMAGE (IN _Exit FUNCTION)...!!!
        Else
        $hImage = _GDIPlus_ImageLoadFromFile($_MOUNT_BACK)  ;use '$_MOUNT_BACK'...to load the originaly selected 'IMAGE' file...
        EndIf  ;'$_IMAGE_BACK' is NOT "-1"...OR NOT...

                $_External_Height = _GDIPlus_ImageGetHeight($hImage)
                $_External_Width = _GDIPlus_ImageGetWidth($hImage)

      EndIf  ;Ubound(_SAVED_SLOTS) <= "0"...the 'delete' process left the '' array 'empty'...

     ;**

      if Ubound($_SAVED_SLOTS) > 0 Then

      $_SECOND_SLOTS = $_SAVED_SLOTS
        ;save '$_SAVED_SLOTS' array into '$_SECOND_SLOTS' since
        ;the '$_SAVED_SLOTS' needs to be destroyed...

      Global $_SAVED_SLOTS[1]  ;re-declare to 'clear-out' array...
      $_SAVED_SLOTS[0] = -1  ;default

       For $_RIGGING = 0 to Ubound($_SECOND_SLOTS) - 1

       $_CTRL_SELECT = $_SECOND_SLOTS[$_RIGGING]
         ;EACH array variable becomes the '$_CTRL_SELECT' variable...!

        if Number($_IMAGE_BACK) <> -1 Then
        $hImage = _GDIPlus_ImageLoadFromFile($_IMAGE_BACK)
          ;'$_IMAGE_BACK' WILL BE SET AS THE 'LAST' RE-DRAWN IMAGE (IN _Exit FUNCTION)...!!!
        $_ADJUST_SLOTS = $_REMOVE_SLOTS[0]
        Else
        $hImage = _GDIPlus_ImageLoadFromFile($_MOUNT_BACK)  ;use '$_MOUNT_BACK'...to load the originaly selected 'IMAGE' file...
        EndIf  ;'$_IMAGE_BACK' is NOT "-1"...OR NOT...

       $_External_Height = _GDIPlus_ImageGetHeight($hImage)
       $_External_Width = _GDIPlus_ImageGetWidth($hImage)

        if Number($_CONTROL_HWD) == -1 Then

        ;****CREATE THE GUI...

        $_CTRL_GUI = GUICreate("Positioning", Number($_External_Width), Number($_External_Height), -1, -1, BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU, $WS_EX_TOPMOST))
        GUISetBkColor(0xFFFFFF)  ;set GUI background to 'White'...

        GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

        GUISetState(@SW_SHOW, $_CTRL_GUI)

        $_CONTROL_HWD = WinGetHandle($_CTRL_GUI)  ;save the handle to the Window...

        EndIf  ;'$_CONTROL_HWD' is "-1"...the '$_CTRL_GUI' ('$_CONTROL_HWD')
               ;MUST have been deleted re-create if necessary...!

        ;****INITIALIZE NEEDED VARIABLES FOR THE GUI...

        Global $_adjusts = _GDIPlus_GraphicsCreateFromHWND($_CTRL_GUI)
        Global $hBmp_Buffer = _GDIPlus_BitmapCreateFromGraphics($_External_Width, $_External_Height, $_adjusts)
        Global $hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext($hBmp_Buffer)

        Global $hImage3 = _GDIPlus_ImageLoadFromFile($_IMAGE_PATHS[0])  ;create the (WaterMark) image...

       _Draw()  ;draw using only 'pre-set' coordinates...do NOT
                ;use the 'INTERACTIVE' control functions...

       _Exit()  ;call to 'save' and 'complete' the drawing process...
       ;****

       Next  ;Next $_RIGGING, ...create necessary
             ;'background' image file(s)...

      ;**'UNREGISTER'...
      GUIRegisterMsg($WM_LBUTTONDOWN, "")
      GUIRegisterMsg($WM_MOUSEWHEEL, "")
      GUIRegisterMsg($WM_MOUSEMOVE, "")
      GUIRegisterMsg($WM_LBUTTONUP, "")
      ;**

      EndIf  ;Ubound(_SAVED_SLOTS) > "0"

     ;**cycle thru '_Slots' DIRECTORY to test filenames within to find a 'matching' file for
     ;usage as the 'final' needed 'background' image...if NOT EXTANT then will need to test
     ;for 'best' match and create an additional '$_NEW_SLOTS' file(s)...

     $_Num_Files = -1  ;default
     $_Scan_Files = 0  ;re-assign to 'free' array...

     $_source = FileFindFirstFile(@ScriptDir & "\_Outputs\_Slots\*.jpg")
     $_Scan_Files = DirGetSize(@ScriptDir & "\_Outputs\_Slots", $DIR_EXTENDED)

      if (Number($_Scan_Files) == -1) OR (IsArray($_Scan_Files) <> 1) Then MsgBox(64, "Directory Error:", "Problem reading desired Directory for '$_Scan_Files' #2...error: " & @error)
      if (Number($_Scan_Files) <> -1) AND (IsArray($_Scan_Files) == 1) Then $_Num_Files = $_Scan_Files[1]  ;set the # of FILES in the searched Directory...

       if Int($_Num_Files) >= 1 Then

        For $_RIGGING = 1 to Int($_Num_Files)
        $_WORKING_FILE = FileFindNextFile($_source)  ;returns a FileName...(i.e. "@ScriptDir & "\_Outputs\_Slots\XXX.jpg")
;ConsoleWrite(" '$_WORKING_FILE' #2: " & String($_WORKING_FILE) & @CRLF)
;ConsoleWrite(" 'String('Slot_Image' & $_Search & '.jpg')': " & String("Slot_Image" & $_Search & ".jpg") & @CRLF)

         if StringCompare(String($_WORKING_FILE), String("Slot_Image" & $_Search & ".jpg"), $STR_NOCASESENSE) == 0 Then
;ConsoleWrite(" THERE IS AN EXTANT 'MATCH'...!!!!  WHICH IS: " & String($_WORKING_FILE) & @CRLF)

         $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\_Outputs\_Slots\" & String($_WORKING_FILE))
           ;load the 'SLOT' image file that contains needed 'elements'...

         $_External_Height = _GDIPlus_ImageGetHeight($hImage)
         $_External_Width = _GDIPlus_ImageGetWidth($hImage)

          if Number($_CONTROL_HWD) == -1 Then

           ;****CREATE THE GUI...

           $_CTRL_GUI = GUICreate("Positioning", Number($_External_Width), Number($_External_Height), -1, -1, BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU, $WS_EX_TOPMOST))
           GUISetBkColor(0xFFFFFF)  ;set GUI background to 'White'...

           GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

           GUISetState(@SW_SHOW, $_CTRL_GUI)

           $_CONTROL_HWD = WinGetHandle($_CTRL_GUI)  ;save the handle to the Window...

          EndIf  ;'$_CONTROL_HWD' is "-1"...the '$_CTRL_GUI' ('$_CONTROL_HWD')
                 ;MUST have been deleted during a call to "_Exit"...
                 ;re-create if necessary...!

           ;****INITIALIZE NEEDED VARIABLES FOR THE GUI...

           Global $_adjusts = _GDIPlus_GraphicsCreateFromHWND($_CTRL_GUI)
           Global $hBmp_Buffer = _GDIPlus_BitmapCreateFromGraphics($_External_Width, $_External_Height, $_adjusts)
           Global $hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext($hBmp_Buffer)

           Global $hImage3 = _GDIPlus_ImageLoadFromFile($_IMAGE_PATHS[0])  ;create the (WaterMark) image...

           Global $iMouseX, $iMouseY

           ;$_CTRL_SELECT = $_SAVE_SELECT  ;RESET  the '$_CTRL_SELECT' variable...
           $_MASTER_SWITCH = 1

         EndIf  ;'$_WORKING_FILE' AND '$_Search' are EQUAL 'STRINGs'...

        Next  ;Next $_RIGGING (search all the files in the '_Slots' Folder to find Directories and .jpg files
       EndIf  ;$_Num_Files >= 1 (search through multiple FOLDERS)...

       ; Close the search handle.
       FileClose($_source)

    EndIf  ;$_MASTER_SWITCH NOT "1"...

    if Number($_MASTER_SWITCH) == 1 Then

    GUIRegisterMsg($WM_LBUTTONDOWN, "WM_LBUTTONDOWN")
    GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL")
    GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")
    GUIRegisterMsg($WM_LBUTTONUP, "_POSITION_TRAX")

    _Draw()

    While Number($_CONTROL_HWD) <> -1

    Sleep(10)
    WEnd

    EndIf  ;$_MASTER_SWITCH is "1"...

    ;**'UNREGISTER'...
    GUIRegisterMsg($WM_LBUTTONDOWN, "")
    GUIRegisterMsg($WM_MOUSEWHEEL, "")
    GUIRegisterMsg($WM_MOUSEMOVE, "")
    GUIRegisterMsg($WM_LBUTTONUP, "")
    ;**

    ;**

   ;****

EndFunc  ;"REDRAW_GUI()"

;////////////////////////

Func _POSITION_TRAX($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $wParam

 $_MOUSE_LOCATE = -1  ;re-assign to 'free' array...

    if WinExists($_CONTROL_HWD) Then
    $_WinPOS = WinGetPos($_CONTROL_HWD)
    $tRECT = _WinAPI_GetClientRect($_CTRL_GUI)
    $iTitleHeight = _WinAPI_GetSystemMetrics(31) + 1
    $iBorderHeight = _WinAPI_GetSystemMetrics(7) + 1
    $iBorderWidth = _WinAPI_GetSystemMetrics(8) + 1


     if (IsArray($_WinPOS) == 1) AND (@error <> 1) Then

         ;**
         $_THE_MOUSE = MouseGetPos()

          if ($_THE_MOUSE[0] > ($_WinPOS[0])) AND ($_THE_MOUSE[0] < ($_WinPOS[0] + $_WinPOS[2])) Then
           if ($_THE_MOUSE[1] > ($_WinPOS[1])) AND ($_THE_MOUSE[1] < ($_WinPOS[1] + $_WinPOS[3])) Then

           $_MOUSE_LOCATE = GUIGetCursorInfo($_CTRL_GUI)  ;Gets the mouse cursor position relative to GUI window (client coordinates)

            if IsArray($_MOUSE_LOCATE) <> 1 Then
ConsoleWrite("MOUSE is NOT over the '$_CTRL_GUI ' WINDOW...!!!" & " @error is: " & @error & @CRLF)
            EndIf  ;'$_MOUSE_LOCATE' is NOT an array...
            if IsArray($_MOUSE_LOCATE) == 1 Then

             if ($_MOUSE_LOCATE[0] > (DllStructGetData($tRECT, "Left") + $iBorderWidth)) AND ($_MOUSE_LOCATE[0] < ((DllStructGetData($tRECT, "Right")) - $iBorderWidth)) Then
              if ($_MOUSE_LOCATE[1] > (DllStructGetData($tRECT, "Top") + $iBorderHeight)) AND ($_MOUSE_LOCATE[1] < (DllStructGetData($tRECT, "Bottom")) - $iBorderHeight) Then
              $_MOUSE_LOCATE_X = $_MOUSE_LOCATE[0]  ;X AXIS
              $_MOUSE_LOCATE_Y = $_MOUSE_LOCATE[1]  ;Y AXIS
              $_MOUSE_HOVER = $_MOUSE_LOCATE[4]  ;ID of Control mouse cursor is 'hovered' over ("0" if none)...

               if Number($_CTRL_SELECT) >= 0 Then

                $_XPOS_SETS[$_CTRL_SELECT] = $_MOUSE_LOCATE_X  ;save the 'X' location...for the associated Control
                $_YPOS_SETS[$_CTRL_SELECT] = $_MOUSE_LOCATE_Y  ;save the 'Y' location...for the associated Control

                 if Number($_CTRL_SELECT) == 0 Then
                 GUICtrlSetData($_IMG_POS, "X AXIS: " & $_XPOS_SETS[$_CTRL_SELECT] & " Y AXIS: " & $_YPOS_SETS[$_CTRL_SELECT])
                 GUICtrlSetState($_IMG_POS, $GUI_ENABLE)
                 EndIf  ;'image' is selected
                 if Number($_CTRL_SELECT) == 1 Then
                 GUICtrlSetData($_Line1_POS, "X AXIS: " & $_XPOS_SETS[$_CTRL_SELECT] & " Y AXIS: " & $_YPOS_SETS[$_CTRL_SELECT])
                 GUICtrlSetState($_Line1_POS, $GUI_ENABLE)
                 EndIf  ;'$_Line1' is selected
                 if Number($_CTRL_SELECT) == 2 Then
                 GUICtrlSetData($_Line2_POS, "X AXIS: " & $_XPOS_SETS[$_CTRL_SELECT] & " Y AXIS: " & $_YPOS_SETS[$_CTRL_SELECT])
                 GUICtrlSetState($_Line2_POS, $GUI_ENABLE)
                 EndIf  ;'$_Line2' is selected

               EndIf  ;'$_CTRL_SELECT' > "0"

              EndIf  ;$_MOUSE_LOCATE[1] lies within the Y AXIS 'HEIGHT' of the GUI...
             EndIf  ;$_MOUSE_LOCATE[0] lies within the X AXIS 'WIDTH' of the GUI...

            $_MOUSE_LOCATE = -1  ;re-assign to 'free' array...
            EndIf  ;IsArray($_MOUSE_LOCATE) is 1 ($_MOUSE_LOCATE IS an array...)

           EndIf  ;'$_THE_MOUSE[1]' position is GREATER than image "Y" (TOP) dimension...
                  ;AND position is LESS than image 'Y' (BOTTOM) dimension...
          EndIf  ;'$_THE_MOUSE[0]' position is GREATER than image "X" (LEFT) dimension...
                 ;AND position is LESS than image "X" (RIGHT) dimensions...
         ;**

     EndIf  ;'$_WinPOS' IS an array...AND '@error' NOT "1"...
    EndIf  ;WinExists ($_CONTROL_HWD)...

EndFunc   ;==>_POSITION_TRAX, set the 'final' X, Y AXIS positions
          ;   of the cursor when mouse button is released...
          
Func WM_LBUTTONDOWN($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $wParam

    $iMouseX = BitAND($lParam, 0x0000FFFF)
    $iMouseY = BitShift($lParam, 16)

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_LBUTTONDOWN

Func WM_MOUSEMOVE($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg

    Switch BitAND($wParam, 0x0000FFFF)
        Case 1
            Local $iX = BitAND($lParam, 0x0000FFFF)
            Local $iY = BitShift($lParam, 16)

            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, $iX - $iMouseX, $iY - $iMouseY, True)

            $iMouseX = $iX
            $iMouseY = $iY

            _Draw()
    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_MOUSEMOVE

Func WM_MOUSEWHEEL($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $lParam

    Switch BitAND($wParam, 0x0000FFFF)
        Case 1
            Local $iAngle = -3
            If BitShift($wParam, 16) < 0 Then $iAngle = 3

            Local $aMousePos[2][2] = [[1]]
            $aMousePos[1][0] = $iMouseX
            $aMousePos[1][1] = $iMouseY
            _GDIPlus_GraphicsTransformPoints($hGfx_Buffer, $aMousePos)

            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, $aMousePos[1][0], $aMousePos[1][1])
            _GDIPlus_GraphicsRotateTransform($hGfx_Buffer, $iAngle)
            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, -$aMousePos[1][0], -$aMousePos[1][1])

        Case Else
            Local $aInfo = GUIGetCursorInfo($_CTRL_GUI)
            Local $iScale = 1.1
            If BitShift($wParam, 16) < 0 Then $iScale = 0.9

            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, -$aInfo[0], -$aInfo[1], True)
            _GDIPlus_GraphicsScaleTransform($hGfx_Buffer, $iScale, $iScale, True)
            _GDIPlus_GraphicsTranslateTransform($hGfx_Buffer, $aInfo[0], $aInfo[1], True)
    EndSwitch

    _Draw()
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_MOUSEWHEEL

Func _Draw()

 Local $_DRAW_TXT, $_DRAW_COLOR, $_DRAW_CONFIRM

    _GDIPlus_GraphicsClear($hGfx_Buffer, 0x00000000)

             if (Number($_CTRL_SELECT) == 0) Then
             _GDIPlus_GraphicsDrawImage($hGfx_Buffer, $hImage3, 216, 166)  ;original
             EndIf  ;'$_CTRL_SELECT' is "0"...re-create the 'IMAGE' Control...

             if (Number($_CTRL_SELECT) == 1) AND (IsString(GUICtrlRead($_Line1)) == 1) AND (StringLen(String(GUICtrlRead($_Line1))) > 0) Then
             $_DRAW_TXT = $_TXT_SETS[0]
             $_DRAW_COLOR = $_Line1_SETS[3]

              if (BitAND(GUICtrlRead($_VERT_TXT1), $GUI_CHECKED) = $GUI_CHECKED) Then
              $hFormat = _GDIPlus_StringFormatCreate(2)  ;draws vertically within the image
              Else
              $hFormat = _GDIPlus_StringFormatCreate()  ;draws horizontally within the image
              EndIf  ;'$_VERT_TXT1' checkbox is checked...user wishes 'VERTICAL' text...OR NOT...

             ;control 'FONT SIZE' here...
             $hFamily = _GDIPlus_FontFamilyCreate($_Line1_SETS[0])  ;control 'FONT' used here...
               if Number($_Line1_SETS[2]) <= 400 Then
               $hFont = _GDIPlus_FontCreate($hFamily, $_Line1_SETS[3], 0)
                if Number($_Line1_SETS[1]) > 0 Then $hFont = _GDIPlus_FontCreate($hFamily, $_Line1_SETS[1], Number($_Line1_SETS[4]))
               EndIf  ;NOT BOLD...
               if Number($_Line1_SETS[2]) > 400 Then
               $hFont = _GDIPlus_FontCreate($hFamily, $_Line1_SETS[3], 1)
                if Number($_Line1_SETS[1]) > 0 Then $hFont = _GDIPlus_FontCreate($hFamily, $_Line1_SETS[1], Number(1 + Number($_Line1_SETS[4])))
               EndIf  ;BOLD...


$tLayout = _GDIPlus_RectFCreate(200, 200)
;*******PROBLEM LIES HERE...NOT PRECISELY USING THE SET COORDS TO PLACE THE STRING...!!!!
 if (Number($_XPOS_SETS[1]) <> -1) AND (Number($_YPOS_SETS[1]) <> -1) Then
 $tLayout = _GDIPlus_RectFCreate(Number($_XPOS_SETS[1]), Number($_YPOS_SETS[1]))
 EndIf  ;'$_XPOS_SETS[1]' AND '$_YPOS_SETS[1]' NOT "-1"
               ;control X, Y placement here...

             $aInfo = _GDIPlus_GraphicsMeasureString($hGfx_Buffer, String($_TXT_SETS[0]), $hFont, $tLayout, $hFormat)
             EndIf  ;'$_CTRL_SELECT' is "1" AND '$_Line1' is a STRING...re-create the 'Line1' Control...


             if (Number($_CTRL_SELECT) == 2) AND (IsString(GUICtrlRead($_Line2)) == 1) AND (StringLen(String(GUICtrlRead($_Line2))) > 0) Then
             $_DRAW_TXT = $_TXT_SETS[1]
             $_DRAW_COLOR = $_Line2_SETS[3]

              if (BitAND(GUICtrlRead($_VERT_TXT2), $GUI_CHECKED) = $GUI_CHECKED) Then
              $hFormat = _GDIPlus_StringFormatCreate(2)  ;draws vertically within the image
              Else
              $hFormat = _GDIPlus_StringFormatCreate()  ;draws horizontally within the image
              EndIf  ;'$_VERT_TXT2' checkbox is checked...user wishes 'VERTICAL' text...OR NOT...
             ;control 'FONT SIZE' here...
             $hFamily = _GDIPlus_FontFamilyCreate($_Line2_SETS[0])  ;control 'FONT' used here...
               if Number($_Line2_SETS[2]) <= 400 Then
               $hFont = _GDIPlus_FontCreate($hFamily, $_Line2_SETS[3], 0)
                if Number($_Line2_SETS[1]) > 0 Then $hFont = _GDIPlus_FontCreate($hFamily, $_Line2_SETS[1], Number($_Line2_SETS[4]))
               EndIf  ;NOT BOLD...
               if Number($_Line2_SETS[2]) > 400 Then
               $hFont = _GDIPlus_FontCreate($hFamily, $_Line2_SETS[3], 1)
                if Number($_Line2_SETS[1]) > 0 Then $hFont = _GDIPlus_FontCreate($hFamily, $_Line2_SETS[1], Number(1 + Number($_Line2_SETS[4])))
               EndIf  ;BOLD...

$tLayout = _GDIPlus_RectFCreate(200, 200)
;*******PROBLEM LIES HERE...NOT PRECISELY USING THE SET COORDS TO PLACE THE STRING...!!!!
 if (Number($_XPOS_SETS[2]) <> -1) AND (Number($_YPOS_SETS[2]) <> -1) Then
 $tLayout = _GDIPlus_RectFCreate(Number($_XPOS_SETS[2]), Number($_YPOS_SETS[2]))
 EndIf  ;'$_XPOS_SETS[2]' AND '$_YPOS_SETS[2]' NOT "-1"
               ;control X, Y placement here...

             $aInfo = _GDIPlus_GraphicsMeasureString($hGfx_Buffer, String($_TXT_SETS[1]), $hFont, $tLayout, $hFormat)
             EndIf  ;'$_CTRL_SELECT' is "2" AND '$_Line2' is a STRING...re-create the 'Line2' Control...

             if (Number($_CTRL_SELECT) > 0) Then

             ;**DRAW THE APPROPRIATE STRING...

              if Number(GUICtrlRead($slider1)) == 100 Then $hBrush2 = _GDIPlus_BrushCreateSolid("0xFF" & StringMid($_DRAW_COLOR, 3, 2) & StringMid($_DRAW_COLOR, 5, 2) & StringMid($_DRAW_COLOR, 7, 2))
               ;set the brush color...
              if Number(GUICtrlRead($slider1)) < 100 Then $hBrush2 = _GDIPlus_BrushCreateSolid("0x" & Hex(Int(255 * Number(GUICtrlRead($slider1)) / 100), 2) & StringMid($_DRAW_COLOR, 3, 2) & StringMid($_DRAW_COLOR, 5, 2) & StringMid($_DRAW_COLOR, 7, 2))
               ;set the brush color...with OPACITY...

             _GDIPlus_StringFormatSetAlign($hFormat, 1)

             $_DRAW_CONFIRM = _GDIPlus_GraphicsDrawStringEx($hGfx_Buffer, String($_DRAW_TXT), $hFont, $tLayout, $hFormat, $hBrush2)

             ;**

             EndIf  ;$_CTRL_SELECT > 0

    _GDIPlus_GraphicsDrawImageRect($_adjusts, $hImage, 0, 0, $_External_Width, $_External_Height)
    _GDIPlus_GraphicsDrawImage($_adjusts, $hBmp_Buffer, 0, 0)

             if (Number($_CTRL_SELECT) > 0) Then
             _GDIPlus_FontDispose($hFont)
             _GDIPlus_FontFamilyDispose($hFamily)
             _GDIPlus_StringFormatDispose($hFormat)
             _GDIPlus_BrushDispose($hBrush2)
             EndIf  ;$_CTRL_SELECT > 0

EndFunc   ;==>_Draw

Func _Exit()

 Local $_PROCESS_SLOTS[1], $_SAVED_ELEMENTS, $_VERIFICATION = -1  ;default

 $_PROCESS_SLOTS[0] = -1  ;default

    if WinExists($_CONTROL_HWD) Then
    $_WinPOS = WinGetPos($_CONTROL_HWD)

     if (IsArray($_WinPOS) == 1) AND (@error <> 1) Then

     $tRECT = _WinAPI_GetClientRect($_CTRL_GUI)
     $iTitleHeight = _WinAPI_GetSystemMetrics(31) + 1
     $iBorderHeight = _WinAPI_GetSystemMetrics(7) + 1
     $iBorderWidth = _WinAPI_GetSystemMetrics(8) + 1

     Local $hDDC = _WinAPI_GetDC($_CTRL_GUI)
     Local $hCDC = _WinAPI_CreateCompatibleDC($hDDC)
     Local $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, Number($_WinPOS[2] - 1) - $iBorderWidth, Number($_WinPOS[3] - 1) - ($iTitleHeight + $iBorderHeight))
     _WinAPI_SelectObject($hCDC, $hBMP)
     _WinAPI_BitBlt($hCDC, 0, 0, Number($_WinPOS[2] - 1) - $iBorderWidth, Number($_WinPOS[3] - 1) - ($iTitleHeight + $iBorderHeight), $hDDC, 0, 0, $__SCREENCAPTURECONSTANT_SRCCOPY)
     _WinAPI_ReleaseDC($_CTRL_GUI, $hDDC)
     _WinAPI_DeleteDC($hCDC)

     $_VERIFICATION = _ScreenCapture_SaveImage(@ScriptDir & "\Copy_Image.jpg", $hBMP, True)

      if $_VERIFICATION == "True" Then
      $_FIRST_ROUND += 1
      $_SAVED_ELEMENTS = -1  ;default

       if (IsArray($_SAVED_SLOTS) <> 1) OR (Ubound($_SAVED_SLOTS) <= 0) Then
       $_SAVED_ELEMENTS = $_CTRL_SELECT  ;indicate only the '$_CTRL_SELECT' element is being used...
       EndIf  ;'$_SAVED_SLOTS' is NOT an array with at least 1 element...

       if IsArray($_SECOND_SLOTS) <> 1 Then

        if (IsArray($_SAVED_SLOTS) == 1) AND (Ubound($_SAVED_SLOTS) > 0) Then

         if Number($_SAVED_SLOTS[0]) == -1 Then
         $_SAVED_ELEMENTS = $_CTRL_SELECT  ;indicate only the '$_CTRL_SELECT' element is being used...
         Else
         _ArrayAdd($_SAVED_SLOTS, Number($_CTRL_SELECT))  ;add '$_CTRL_SELECT' to the '$_SAVED_SLOTS' array...
         _ArraySort($_SAVED_SLOTS)  ;sort the array 'NUMERICALLY'...

          if @error <> 0 Then
          MsgBox(64, "Array Error:", "Problem sorting '$_SAVED_SLOTS' array...error: " & @error)
          $_SAVED_ELEMENTS = -1  ;reset to indicate error...!
          Else
          $_SAVED_ELEMENTS = _ArrayToString($_SAVED_SLOTS, "-")

           if @error <> 0 Then
           MsgBox(64, "Array Error:", "Problem copying '$_SAVED_SLOTS' array to '$_SAVED_ELEMENTS'...error: " & @error)
           $_SAVED_ELEMENTS = -1  ;reset to indicate error...!
           EndIf  ;@error NOT 0...
          EndIf  ;@error NOT 0...OR NOT...
         EndIf  ;'$_SAVED_SLOTS[0]' is "-1"...OR NOT...
                ;determine if their are 'elements' that
                ;needed to be 'REDRAWN' (requiring usage
                ;of saved image(s)...)

        EndIf  ;'$_SAVED_SLOTS' IS an array with at least 1 element...

       EndIf  ;'$_SECOND_SLOTS' is NOT an array...

       if IsArray($_SECOND_SLOTS) == 1 Then
;ConsoleWrite(" '$_SECOND_SLOTS' in _Exit is: " & _ArrayToString($_SECOND_SLOTS, "-") & @CRLF)

        if (IsArray($_SAVED_SLOTS) == 1) AND (Ubound($_SAVED_SLOTS) > 0) Then

         if Number($_SAVED_SLOTS[0]) == -1 Then
          if Number($_ADJUST_SLOTS) == -1 Then $_SAVED_ELEMENTS = $_CTRL_SELECT  ;indicate only the '$_CTRL_SELECT' element is being used...
          if Number($_ADJUST_SLOTS) <> -1 Then $_SAVED_ELEMENTS = String($_ADJUST_SLOTS) & "-" & String($_CTRL_SELECT)
         Else
         _ArrayAdd($_SAVED_SLOTS, Number($_CTRL_SELECT))  ;add '$_CTRL_SELECT' to the '$_SAVED_SLOTS'
                                                          ;array...since it has been 'cleared out' it
                                                          ;is available for usage here again...
         _ArraySort($_SAVED_SLOTS)  ;sort the array 'NUMERICALLY'...

          if @error <> 0 Then
          MsgBox(64, "Array Error:", "Problem sorting '$_SAVED_SLOTS #2' array...error: " & @error)
          $_SAVED_ELEMENTS = -1  ;reset to indicate error...!
          Else
          $_SAVED_ELEMENTS = _ArrayToString($_SAVED_SLOTS, "-")

           if @error <> 0 Then
           MsgBox(64, "Array Error:", "Problem copying '$_SAVED_SLOTS #3' array to '$_SAVED_ELEMENTS'...error: " & @error)
           $_SAVED_ELEMENTS = -1  ;reset to indicate error...!
           EndIf  ;@error NOT 0...
          EndIf  ;@error NOT 0...OR NOT...
         EndIf  ;'$_SAVED_SLOTS[0]' is "-1"...OR NOT...
                ;determine if their are 'elements' that
                ;needed to be 'REDRAWN' (requiring usage
                ;of saved image(s)...)

        EndIf  ;'$_SAVED_SLOTS' IS an array with at least 1 element...

       EndIf  ;'$_SECOND_SLOTS' IS an array...

;consolewrite("String($_SAVED_ELEMENTS) is: " & String($_SAVED_ELEMENTS) & @CRLF)

       ;**SAVE THE 'SLOT' IMAGE...
        if Number($_SAVED_ELEMENTS) <> -1 Then
        $_COPY_CONFIRM = FileCopy(@ScriptDir & "\Copy_Image.jpg", @ScriptDir & "\_Outputs\_Slots\Slot_Image" & String($_SAVED_ELEMENTS) & ".jpg", $FC_OVERWRITE + $FC_CREATEPATH)
        ;$_COPY_CONFIRM = FileCopy(@ScriptDir & "\Copy_Image.jpg", @ScriptDir & "\_Outputs\Slot_Image" & String($_SAVED_ELEMENTS) & ".jpg", $FC_OVERWRITE + $FC_CREATEPATH)

         if Number($_COPY_CONFIRM) == 1 Then

          ;**RECORD THE 'PATHS' OF THE NEWLY CREATED IMAGE BACKGROUND FILES...IF NECESSARY
          if IsArray($_SAVED_SLOTS) == 1 Then
          $_IMAGE_BACK = @ScriptDir & "\_Outputs\_Slots\Slot_Image" & String($_SAVED_ELEMENTS) & ".jpg"
          ;$_IMAGE_BACK = @ScriptDir & "\_Outputs\Slot_Image" & String($_SAVED_ELEMENTS) & ".jpg"
            ;set the '$_IMAGE_BACK' for usage as the 'background' image to be used for the subsequent image file creation...
          EndIf  ;'$_SAVED_SLOTS' IS an array...
          ;**

         Else
         MsgBox(64, "Image Error:", "Problem copying 'Copy_Image' image to 'Slot_Image'...error:" & @error)
         EndIf  ;'$_COPY_CONFIRM' is "1"...FileCopy was successful...OR NOT...
        EndIf  ;'$_SAVED_ELEMENTS' NOT "-1"
       ;**

      EndIf  ;'$_VERIFICATION' is "True"...image was 'captured'...

     EndIf  ;'$_WinPOS' IS an array...AND '@error' NOT "1"...

    EndIf  ;WinExists ($_CONTROL_HWD)...

    GUIDelete($_CTRL_GUI)
    $_CONTROL_HWD = -1  ;default/reset
    $_CTRL_SELECT = -1  ;default/reset

    ;**ACTIVATE MAIN GUI AGAIN...!!!
    $_INIT_MAIN = WinActivate($MainGUI)  ;save the handle to the Window...

    _GDIPlus_ImageDispose($hImage)

EndFunc   ;==>_Exit

Func SpecialEvents()
    Select
        Case @GUI_CtrlId = $GUI_EVENT_CLOSE

            MsgBox(0, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)
            _GDIPlus_Shutdown()  ;Shut down GDI+ library

            DllClose($hDLL)

            Exit

        Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE
            MsgBox(0, "Window Minimized", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

        Case @GUI_CtrlId = $GUI_EVENT_RESTORE
            MsgBox(0, "Window Restored", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle)

    EndSelect
EndFunc   ;==>SpecialEvents

Greetings,

  I'm having a problem I cannot seem to resolve...even after spending countless hours trying to figure it out.  I think the best way to explain it is to place the working code I included below into a folder, and place the two (.jpg 'background' image and a .png file) images into the same folder as well.  It should be possible to re-create the issue I'm having following my instructions below.

 STEPS TO RE-CREATE PROBLEM ISSUE:

 Execute my supplied code script.  Upon program startup do the following...

 1.  Click the 'radio' button labeled "image from file"...upon doing so this should bring up a GUI where the .png image ("www.sample.com") will be displayed within the GUI.  You may click/drag this image around and place where you would like.  Press the 'Close' button in the GUI (the red "X" in the top right corner).  A sceencapture of the image will be taken and placed into the "_Outputs\_Slots" directory within the script directory.  The image will be named "Slot_Image0".
 2.  Click the cursor into the input control labeled "example", then press "Enter"...this should bring up a dialog to allow you to pick a font, size, and color.  When that is done, as above, you should be able to move this string around the GUI window and place where you would like.  Press the 'Close' button in the GUI (the red "X" in the top right corner).  A screencapture of the image will be taken and placed into the "_Outputs\_Slots" directory within the script directory.  The image will be named "Slot_Image0-1".
 3.  Click the cursor into the input control labeled "text", then press "Enter"...this should bring up a dialog to allow you to pick a font, size, and color.  When that is done, as above, you should be able to move this string around the GUI window and place where you would like.  Press the 'Close' button in the GUI (the red "X" in the top right corner).  A screencapture of the image will be taken and placed into the "_Outputs\_Slots" directory within the script directory.  The image will be named "Slot_Image0-1-2".
 4.  Repeat Step 2 above...to represent the user wanting to change the position of the string that was first labeled "example".  Again click the cursor into the input control labeled "example", then press "Enter"...this should bring up a dialog to allow you to pick a font, size, and color.  When that is done, as above, you should be able to move this string around the GUI window and place where you would like.  Press the 'Close' button in the GUI (the red "X" in the top right corner).  A sccreencapture of the image will be taken and placed into the "_Outputs\_Slots" directory within the script directory.  The image will be named "Slot_Image0-2".

    Now here is the problem.  Look at the 'captured' images that are within the "_Outputs\_Slots" directory.  You should notice the image taken at Step 4 (named "Slot_Image0-2") has the string ("text" in this example if you  did not change it) printed in a different location than it should be.  That string SHOULD be placed in the same exact location as it had been ORIGINALLY (following Step 3 in the image named "Slot_Image0-1-2")...however it is not...I am at a total loss as to why...my script saves the 'client' location within the GUI window and uses it to place the 're-drawn' image...so I cannot understand why the location is not correct...???  Any help suggestions would be greatly appreciated, as I mentioned I have spent a lot of time trying to resolve this issue...regards.

 

 

 

back_reference3.jpg

sample_com.png

Link to comment
Share on other sites

Nobody...?

OK alternatively does anybody know of a way to save 'client coordinate' screen positions (X, Y Axis) to use for later placement in EXACTLY the same position...it may be in my code the GUI 'caption' and 'border' are causing my problem, however I cannot seem to reconcile the sizes of those areas with the amount of pixels the redrawn string is off by...

 

Link to comment
Share on other sites

  Well after yet some more testing I believe it is not the 'caption' and/or 'border' of the GUI that is causing my problem with re-creating string placement...

  I believe (and can be somewhat sure) that it is in fact the position of the mouse cursor when 'dragging' the string to be re-created.  It seems the placement of the string varies according to where the cursor was located when dragging.

  Which leads to my next question...is there some way of compensating the position of the image/string with the position of the mouse cursor...?  Thanks in advance for any advice...although it seems there will be none...   hehe      

 

Link to comment
Share on other sites

Hello,

  The more I test this the more it seems this might actually rise to the level of a system bug...I cannot be sure because I don't know what would classify as one or how to report a possible bug if it were...

  All I can say at this point is the string that needs to be 'redrawn' is certainly NOT placed in the final X, Y client coordinates, and it seems to be directly correlated with the position of the mouse cursor when 'dragging' the string around the GUI window...

 

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

Hello,

  Thanks for the response, sorry late reply.  No that is not the issue, the coordinates are 'client' coordinates.

  I eventually was able to come up with a solution...but thank you anyway.  Regards.   

 

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

  Well a bit hard to explain, and still a little buggy...but the problem was caused by the fact the (client) coordinates did not reflect the 'offset' of where to place the 'top left' corner of the string/image, since they return only the cursor position in the GUI.  So I have to calculate an 'error offset' based upon the initial placement of the string centered in the GUI and use the pixel length (horizontal & vertical) of the string/image to figure how far 'away' the placement is from the center point.  Once I have this 'error offset' I can use it to adjust the client coordinates to correctly place the string/image.

  It works fairly well, however i'm still having some minor issues...I use GUIRegisterMsg for mouse 'down' clicks and mouse 'up' clicks to record client coordinates...however the clicks happen so quickly it seems the different functions for 'down' and 'up' clicks are interfering with one another.  'Double-clicks' also seem to possibly cause a problem.  I think the fact that a 'down' click may be called multiple times may be the issue...will know more later today with additional testing... 

 

 

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...