Sign in to follow this  
Followers 0
Jex

Creating Line

2 posts in this topic

#1 ·  Posted (edited)

I'm trying create line without use GUICtrlSetGraphic ( $GUI_GR_LINE ) or _GDIPlus_GraphicsDrawLine

But my Mathematics not good.

#include <GUIConstants.au3>

$Width = 500
$Height = 500
$Form = GUICreate("Test", $Width, $Height)

Line(50, 50, 450, 400)

Func Line($x, $y, $x2, $y2)
    GUICtrlCreateGraphic(0, 0, $Width, $Height)
    $Step = (($x2 - $x) + ($y2 - $y))
    For $i = 1 To $Step
        GUICtrlSetGraphic(-1, $GUI_GR_PIXEL, $x + ($i * (($x2 - $x) / $Step)), $y + ($i * (($y2 - $y) / $Step)))
    Next
    GUISetState()
EndFunc

Do
Until GUIGetMsg() = -3

I'm created that but i think that completely wrong.

I think here explain how to create line but i'm didnt understood : http://en.wikipedia.org/wiki/Line_(mathematics)

Edited by Jex

Share this post


Link to post
Share on other sites



I'm trying create line without use GUICtrlSetGraphic ( $GUI_GR_LINE ) or _GDIPlus_GraphicsDrawLine

But my Mathematics not good.

I'm created that but i think that completely wrong.

I think here explain how to create line but i'm didnt understood : http://en.wikipedia.org/wiki/Line_(mathematics)

Doesn't do negative slope. Try Line(450, 400, 50, 50).

Test it with mixed conditions of $x > $x2, $y > $y2, and with 0 and infinite slope:

Line(50, 50, 450, 450)

Line(450, 450, 50, 50)

Line(50, 450, 450, 50)

Line(450, 50, 50, 450)

Line(250, 50, 250, 450)

Line(50, 250, 450, 250)

Line(250, 450, 250, 50)

Line(450, 250, 50, 250)

Good start though! Keep at it.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
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
Sign in to follow this  
Followers 0