GordonFreeman Posted March 14, 2016 Posted March 14, 2016 (edited) Hi, this are a logic problem, i am creating a square 50x50 and when i point the AIM with AutoIt Window Info with magnify the "color" of the square start at 10 and end in 59 59-10 = 49 not 50, why it nots end in 50? #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 800, 600,-1,-1) GUICtrlCreateLabel("",10,10,50,50) GUICtrlSetBkColor(-1,0x0000FF) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Edited March 14, 2016 by GordonFreeman Frabjous Installation
InunoTaishou Posted March 14, 2016 Posted March 14, 2016 (edited) My AutoIt Window Info tool returns Quote >>>> Window <<<< Title: Form1 Class: AutoIt v3 GUI Position: 558, 207 Size: 806, 629 Style: 0x94CA0000 ExStyle: 0x00000100 Handle: 0x000000000086062C >>>> Control <<<< Class: Static Instance: 1 ClassnameNN: Static1 Name: Advanced (Class): [CLASS:Static; INSTANCE:1] ID: 3 Text: Position: 10, 10 Size: 50, 50 ControlClick Coords: 23, 30 Style: 0x50020100 ExStyle: 0x00000000 Handle: 0x00000000003B03CA >>>> Mouse <<<< Position: 594, 273 Cursor ID: 0 Color: 0x0000FF And storing the id of the label in $lblRect gives me the same as the info tool While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $lblRect Local $size = ControlGetPos($Form1, "", $lblRect) ConsoleWrite($size[0] & ", " & $size[1] & " | " & $size[2] & ", " & $size[3] & @LF) EndSwitch WEnd Edited March 14, 2016 by InunoTaishou
Moderators Melba23 Posted March 15, 2016 Moderators Posted March 15, 2016 GordonFreeman, Quote i am creating a square 50x50 and [...] the square start at 10 and end in 59 59-10 = 49 not 50 Oh yes it is. That simple subtraction gives you the difference between the 2 numbers - but if you look carefully there are indeed 50 pixels: 10 ] 30 ] 50 ] 11 ] 31 ] 51 ] 12 ] 32 ] 52 ] 13 ] 33 ] 53 ] 14 ] 34 ] 54 ] 15 ] 35 ] 55 ] 16 ] 36 ] 56 ] 17 ] 37 ] 57 ] 18 ] 38 ] 58 ] 19 ] - first 10 39 ] - third 10 59 ] - fifth 10 20 ) 40 ) 21 ) 41 ) 22 ) 42 ) 23 ) 43 ) 24 ) 44 ) And 5 x 10 = 50 25 ) 45 ) 26 ) 46 ) 27 ) 47 ) 28 ) 48 ) 29 ) - second 10 49 ) - fourth 10 The subtraction ignores the "10" pixel. M23 GordonFreeman 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
GordonFreeman Posted March 19, 2016 Author Posted March 19, 2016 On 15/03/2016 at 7:50 AM, Melba23 said: GordonFreeman, Oh yes it is. That simple subtraction gives you the difference between the 2 numbers - but if you look carefully there are indeed 50 pixels: 10 ] 30 ] 50 ] 11 ] 31 ] 51 ] 12 ] 32 ] 52 ] 13 ] 33 ] 53 ] 14 ] 34 ] 54 ] 15 ] 35 ] 55 ] 16 ] 36 ] 56 ] 17 ] 37 ] 57 ] 18 ] 38 ] 58 ] 19 ] - first 10 39 ] - third 10 59 ] - fifth 10 20 ) 40 ) 21 ) 41 ) 22 ) 42 ) 23 ) 43 ) 24 ) 44 ) And 5 x 10 = 50 25 ) 45 ) 26 ) 46 ) 27 ) 47 ) 28 ) 48 ) 29 ) - second 10 49 ) - fourth 10 The subtraction ignores the "10" pixel. M23 Thankss. I think because coords start at 0 but this no have relation. Then if i create a square with [100,100,5,5] then 100,100 (1) / 101,100 (2) / 102,100 (3) / 103,100 (4) / 104,100 (5). big thanks Frabjous Installation
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