Click to See Complete Forum and Search --> : Do you know where I can find arrow line control for my application?


kevin shen
April 24th, 2001, 04:28 PM
I try to use shape or line control to draw diagrm in my application. Do you know where I can find other misc.shape controls or arrow line control for my application?

Thanks!

Best Regards,

Kevin Shen

shree
April 24th, 2001, 09:16 PM
If the code to draw an arrow will work, then here it is.


option Explicit

private Const PI = 3.1416
private Sub Arrow(x1 as Single, y1 as Single, x2 as Single, y2 as Single, l as Single, theta as Single)
Dim phi as Single
If x1 = x2 then
If y1 < y2 then
phi = 90 * (PI / 180)
else
phi = 270 * (PI / 180)
End If
else
phi = Atn((y2 - y1) / (x1 - x2))
If x1 < x2 then phi = phi + PI
End If
Line (x1, y1)-(x2, y2)
Line (x2, y2)-(x2 + l * Cos(phi - theta * (PI / 180)), y2 - l * Sin(phi - theta * (PI / 180)))
Line (x2, y2)-(x2 + l * Cos(phi + theta * (PI / 180)), y2 - l * Sin(phi + theta * (PI / 180)))
End Sub

private Sub Command1_Click()
Dim i as Single
for i = 0 to 2 * 3.1416 step 0.2
Call Arrow(320, 240, 320 + 200 * Cos(i), 240 - 200 * Sin(i), 20, 30)
next i
End Sub




l and Theta are the parameters that control the shape of the arrowhead.

shree
April 24th, 2001, 09:17 PM
If the code to draw an arrow will work for you, then here it is.


option Explicit

private Const PI = 3.1416
private Sub Arrow(x1 as Single, y1 as Single, x2 as Single, y2 as Single, l as Single, theta as Single)
Dim phi as Single
If x1 = x2 then
If y1 < y2 then
phi = 90 * (PI / 180)
else
phi = 270 * (PI / 180)
End If
else
phi = Atn((y2 - y1) / (x1 - x2))
If x1 < x2 then phi = phi + PI
End If
Form1.Line (x1, y1)-(x2, y2)
Form1.Line (x2, y2)-(x2 + l * Cos(phi - theta * (PI / 180)), y2 - l * Sin(phi - theta * (PI / 180)))
From1.Line (x2, y2)-(x2 + l * Cos(phi + theta * (PI / 180)), y2 - l * Sin(phi + theta * (PI / 180)))
End Sub

private Sub Command1_Click()
Dim i as Single
for i = 0 to 2 * 3.1416 step 0.2
Call Arrow(320, 240, 320 + 200 * Cos(i), 240 - 200 * Sin(i), 20, 30)
next i
End Sub




l and Theta are the parameters that control the shape of the arrowhead.

John G Duffy
April 25th, 2001, 02:36 PM
Code to draw an arrow looks more like a StarBurst to me,

John G