CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 1999
    Location
    California
    Posts
    264

    Do you know where I can find arrow line control for my application?

    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
    Best Regards,

    Kevin Shen

  2. #2
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Do you know where I can find arrow line control for my application?

    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.


  3. #3
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Do you know where I can find arrow line control for my application?

    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.


  4. #4
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: Do you know where I can find arrow line control for my application?

    Code to draw an arrow looks more like a StarBurst to me,

    John G

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured