View Single Post
  #2 (permalink)  
Old 05-18-2008, 05:45 PM
Erel's Avatar
Erel Erel is offline
Administrator
 
Join Date: Apr 2007
Posts: 3,185
Default

You will need to write the drawing algorithms yourself.
The following code demonstrates a simple way to draw dashed lines:
(length is the length of each section in the dashed line)
Code:
Sub Globals
    'Declare the global variables here.
    Dim xx,yy
End Sub

Sub App_Start
    Form1.Show
End Sub

Sub DashLine(length,x1,y1,x2,y2,color)
    b = ATan((y2-y1)/(x2 + 0.00001 - x1))
    total = Sqrt((x2-x1)^2+(y2-y1)^2)
    x = x1
    y = y1
    cs = Cos(b) * length
    sn = Sin(b) * length
    If x2 < x1 Then 
        cs = -cs
        sn = -sn
    End If
    For i = 0 To total Step 2*length
        xEnd = x + cs
        yEnd = y + sn
        form1.Line(x,y,xend,yend,color)
        x = xEnd + cs
        y = yEnd + sn
    Next
End Sub


Sub Form1_MouseDown (x,y)
    DashLine(5,xx,yy,x,y,cBlue)
    xx = x
    yy = y
End Sub
Reply With Quote