Hi all
I want to draw 2 line and 2 text on the desktop, and move the position based on the value of the input
This is what i have done:
AutoIt
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Local $hDC, $hPen, $obj_orig $Form1_1 = GUICreate("Form1", 201, 126, -1, -1) $Input1 = GUICtrlCreateInput("20", 16, 24, 121, 21) $Input2 = GUICtrlCreateInput("20", 16, 64, 121, 21) $Button1 = GUICtrlCreateButton("1", 144, 24, 43, 25) $Button2 = GUICtrlCreateButton("2", 146, 65, 43, 25) GUISetState(@SW_SHOW) $tRECT_X = DllStructCreate($tagRect) DllStructSetData($tRECT_X, "Left", @DesktopWidth / 2) DllStructSetData($tRECT_X, "Top", 25) DllStructSetData($tRECT_X, "Right", 55) DllStructSetData($tRECT_X, "Bottom", 40) $tRECT_Y = DllStructCreate($tagRect) DllStructSetData($tRECT_Y, "Left", 20) DllStructSetData($tRECT_Y, "Top", @DesktopHeight / 4) DllStructSetData($tRECT_Y, "Right", 55) DllStructSetData($tRECT_Y, "Bottom", @DesktopHeight / 3) $hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop) $hPen = _WinAPI_CreatePen($PS_SOLID, 3, 0x0000FF) $obj_orig = _WinAPI_SelectObject($hDC, $hPen) _WinAPI_DrawLine($hDC, 20, 20, 20, @DesktopHeight / 3) _WinAPI_DrawLine($hDC, 20, 20, @DesktopWidth / 3, 20) _WinAPI_SetBkMode($hDC, $TRANSPARENT) _WinAPI_SetTextColor($hDC, 0x0000FF) _WinAPI_DrawText($hDC, "X", $tRECT_X, $DT_CENTER) _WinAPI_DrawText($hDC, "Y", $tRECT_Y, $DT_CENTER) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ; refresh desktop _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN) ; clear resources _WinAPI_SelectObject($hDC, $obj_orig) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDC) Exit Case $Button1 EndSwitch WEnd
My problem is are i don't know how to move the lines and text based the position of the desktop size
Example:
If input1 is 50 the vertical line goes to 50px from the left, and move the also text
If input2 is 50 the horizontal line goes to 50px from the top, and move the also text
And make everything based on desktop size, now i don't think my "math" is correct
Thanks for any help