Results 1 to 7 of 7

Thread: Drawing in Picture Box Question

  1. #1

    Thread Starter
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935

    Drawing in Picture Box Question

    Hi all

    Just wanted to know if there was any easy method of drawing curved lines that look any good?

    eg

    A curved Command Button outline

    I have looked into the help and all i have found is the line control and plotting individual pixels but they either take too much code or look really bad

  2. #2
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357
    Seems to me that you could take two coordinates (x1,y1) and (x2,y2) that define a box, then get the radius you want (how much rounding you want for the corners).

    Then just draw a line from x1 + radius to x2 - radius, draw 90 degrees of a circle using (x2 - radius, y1 + radius) for the center, and continue on around the box, rounding the corners as you go.
    ~seaweed

  3. #3

    Thread Starter
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935
    I dont quite see how that would work when all you can draw is a straight line

    That would end up giving the box diagonal edges unless i have worked out what you were trying to say wrong!!

  4. #4
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Why not use "DrawArc" API?
    Baaaaaaaaah

  5. #5

    Thread Starter
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935
    lol I love it when there is nice easy way to go about things

    thanks abdul

  6. #6

    Thread Starter
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935
    ummm Abdul

    I cant find that Api ??

    and on looking in MSDN its only refernce is as part of the .NET framework where it is the

    VB Code:
    1. Graphics.DrawArc

    And im not using .NET

  7. #7
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    ops..the functions are called "Arc" and "ArcTo", and their declarations are like this:

    VB Code:
    1. Public Declare Function Arc Lib "gdi32" Alias "Arc" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long, ByVal X4 As Long, ByVal Y4 As Long) As Long
    2. Public Declare Function ArcTo Lib "gdi32" Alias "ArcTo" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long, ByVal X4 As Long, ByVal Y4 As Long) As Long
    Baaaaaaaaah

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