Fossil Rock Posted August 1, 2006 Share Posted August 1, 2006 I can't seem to get the pixel to draw, can anyone see what I'm doing wrong. expandcollapse popup$_NL = 0 $_NT = 0 $_NR = 11 $_NB = 11 $GUI_GR_PIXEL = "" $GUI_GR_COLOR = "" $GUI_GR_REFRESH = "" $GUI_GR_LINE = "" Dim $_Array[$_NB-$_NT+1][$_NR-$_NL+1] $Form1 = GUICreate(".", 100, 100, 600, 300) $Graphic1 = GUICtrlCreateGraphic(0, 0, 12, 12) $PCS = GUICtrlCreateLabel("", 32, 10, 70, 17) $NX = GUICtrlCreateLabel("", 32, 25, 70, 17) $NY = GUICtrlCreateLabel("", 32, 40, 70, 17) $x = GUICtrlCreateLabel("", 32, 55, 70, 17) $y = GUICtrlCreateLabel("", 32, 70, 70, 17) GUICtrlCreateLabel("", 32, 85, 70, 17) GUISetBkColor(16777215) GUISetState(@SW_SHOW) $POS = WinGetPos(".") _LoadPixelRect($_NL, $_NT, $_NR, $_NB) For $_NY = $_NT To $_NB For $_NX = $_NL To $_NR ; MouseMove( $_NX+$POS[0]+3, $_NY+$POS[1]+29 ) ; Points to the location of the Pixel to be colored GUICtrlSetGraphic ( $Graphic1, $GUI_GR_COLOR, $_Array[$_NY-$_NT][$_NX-$_NL] ) ; GUISetBkColor($_Array[$_NY-$_NT][$_NX-$_NL]) ; Changes the background color to verify color is being read properly GUICtrlSetGraphic ( $Graphic1, $GUI_GR_PIXEL, $_NX+$POS[0]+3, $_NY+$POS[1]+29 ) GUICtrlSetGraphic ( $Graphic1, $GUI_GR_REFRESH ) GUICtrlSetData ( $PCS, $_Array[$_NY-$_NT][$_NX-$_NL] ) GUICtrlSetData ( $NX, $_NX+$POS[0]+3 ) GUICtrlSetData ( $NY, $_NY+$POS[1]+29 ) GUICtrlSetData ( $x, $_NX-$_NT ) GUICtrlSetData ( $y, $_NY-$_NL ) ; Sleep(500) ; Slows it down to verify numbers Next ; SplashTextOn("","", $_NX, $_NY, $POS[0]+3, $POS[1]+29, 1 + 16 ) ; Draws a box to verify placement Next While 1 WEnd Func _LoadPixelRect($_NL, $_NT, $_NR, $_NB) If ($_NL > $_NR Or $_NT > $_NB) Then SetError(1) Return 0 EndIf For $_NY = $_NT To $_NB For $_NX = $_NL To $_NR $_Array[$_NY-$_NT][$_NX-$_NL] = PixelGetColor($_NX,$_NY) Next Next Return $_Array EndFunc Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
martin Posted August 1, 2006 Share Posted August 1, 2006 The problem is here I think GUICtrlSetGraphic ( $Graphic1, $GUI_GR_PIXEL, $_NX+3, $_NY+29 );$_NX+$POS[0]+3, $_NY+$POS[1]+29 ) Points are relative to the graphic so you should not add the position of the form. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Fossil Rock Posted August 1, 2006 Author Share Posted August 1, 2006 That's a very good point, unfortunately it did not work for me. The +3 & +29 are to compensate for the dialog borders (left & top) which aren't needed either. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
martin Posted August 1, 2006 Share Posted August 1, 2006 That's a very good point, unfortunately it did not work for me.The +3 & +29 are to compensate for the dialog borders (left & top) which aren't needed either.True, the +3 and +29 shouldn't be there.I think you should have this at the beginning of your program#include <GUIConstants.au3>and remove your $GUI_GR... variable definitions which are wrong. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Fossil Rock Posted August 1, 2006 Author Share Posted August 1, 2006 I just figured that out. Thanks for the replies. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
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