erifash Posted April 1, 2005 Posted April 1, 2005 i've been trying to create a function to draw a line between two points, but with no success. here is what i have so far: #include <GUIConstants.au3> Func GUICtrlCreateLine($x1, $y1, $x2, $y2) For $a = $y1 to $y2 step 5 For $b = $x1 to $x2 step 5 GUICtrlCreateLabel("", $a, $b, 5, 5, 0x1000) Next Next EndFunc GUICreate("") GUICtrlCreateLine(0, 0, 50, 70) GUISetState() sleep(5000) if you try it out it only creates a grid... someone please help! My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
GaryFrost Posted April 1, 2005 Posted April 1, 2005 http://www.autoitscript.com/forum/index.php?showtopic=9672 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
layer Posted April 1, 2005 Posted April 1, 2005 (edited) Global $edge Func _GUICtrlCreateEdge($x, $y, $width, $height, $color) $edge= GUICtrlCreateLabel("", $x, $y, $width, $height, 0x1000) GUICtrlSetBkColor($edge, $color) EndFunc GUICreate("Edge demo") _GUICtrlCreateEdge(10, 10, 10, 100, 0x00FF00) GUISetState() While 1 $get = GUIGetMsg() If $get = -3 then exit WEnd should work.. EDIT: gaforst you beat me to it! hehe Edited April 1, 2005 by layer FootbaG
erifash Posted April 1, 2005 Author Posted April 1, 2005 that was the post that i was looking at when i got the idea for this. i just realized then that there was no function to make a line between two pionts such as on a TI-83+ graphing calculator: point 0, 1 point 4, 5 the graph would be: 00000 \0000 0\000 00\00 000\0 Do you people see what i'm saying now? My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
sylvanie Posted April 1, 2005 Posted April 1, 2005 hello, I think that in your case, it's an equation : y=a*x+b #include <GUIConstants.au3> Func GUICtrlCreateLine($x1, $y1, $x2, $y2) $coeff_line=($y2-$y1)/($x2-$x1) $p=$y2-$coeff_line*$x2 For $a = $x1 to $x2 step 5 GUICtrlCreateLabel("", $a, $a*$coeff_line+$p, 5, 5,0x1000) Next EndFunc GUICreate("") GUICtrlCreateLine(0, 0, 50, 70) GUISetState() sleep(5000) Is it ?
layer Posted April 1, 2005 Posted April 1, 2005 hello, I think that in your case, it's an equation : y=a*x+b #include <GUIConstants.au3> Func GUICtrlCreateLine($x1, $y1, $x2, $y2) $coeff_line=($y2-$y1)/($x2-$x1) $p=$y2-$coeff_line*$x2 For $a = $x1 to $x2 step 5 GUICtrlCreateLabel("", $a, $a*$coeff_line+$p, 5, 5,0x1000) Next EndFunc GUICreate("") GUICtrlCreateLine(0, 0, 50, 70) GUISetState() sleep(5000)Is it ?<{POST_SNAPBACK}>That could also be done with _GUICtrlCreateEdge... FootbaG
sylvanie Posted April 1, 2005 Posted April 1, 2005 That could also be done with _GUICtrlCreateEdge...hum, I don't know what is this function.I have not found it in UDF, could you tell me where is it please ?
layer Posted April 1, 2005 Posted April 1, 2005 http://www.autoitscript.com/forum/index.php?showtopic=9672<{POST_SNAPBACK}> FootbaG
erifash Posted April 1, 2005 Author Posted April 1, 2005 (edited) wow, that is perfect thank you! here is a slightly modified version of that script: #include <GUIConstants.au3> Func GUICtrlCreateLine($x1, $y1, $x2, $y2) $coeff_line = ( $y2-$y1 ) / ( $x2-$x1 ) $p = $y2 - ( $coeff_line * $x2 ) For $a = $x1 to $x2 step 1 GUICtrlCreateLabel("", $a, ( $a * $coeff_line ) + $p, 1, 1,0x1000) Next EndFunc GUICreate("") GUICtrlCreateLine(0, 0, 100, 300) GUICtrlCreateLine(50, 300, 300, 20) GUISetState() sleep(5000) thank you again, this could be a very big breakthrough in autoit! EDIT: i'll post it in scripts and scraps Edited April 1, 2005 by erifash My UDFs:_FilePrint() | _ProcessGetName() | _Degree() and _Radian()My Scripts:Drive Lock - Computer Lock Using a Flash DriveAU3Chat - Simple Multiuser TCP ChatroomStringChunk - Split a String Into Equal PartsAutoProxy - Custom Webserver
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