locked
Different corners when connecting lines RRS feed

  • Question

  • User-296603942 posted

    Hi,

    I'm just digging into graphics, and it's a lot of fun! Right now I'm trying to create polygons, and it works just fine. My problem is that I need some of the edges to be "miter" (what kind of a word is that anyway?) and some of them to be smooth.

    To achieve this, I created a two-dimensional array, where the inner arrays held the x and y coordinates and also the letter M or R (as in round). Then I tried to draw each of the line by itself, instead of doing a polygon: 

    'Line join type for this particular angle

    Dim jt As String = arr(0)(2)

    If jt = "M" Then

        myPen.LineJoin = Drawing2D.LineJoin.Miter

     

    ElseIf jt = "R" Then

        myPen.LineJoin = Drawing2D.LineJoin.Round

    End If

     but it didn't really work out for me (and logically it won't that way, because how could the line know where to connect to the next line...). So, is there a property I am missing, or what should I do?

    (In case my question is unclear: Take a box, with three square corners and one rounded corner. That's what I'm trying to achieve.)

    Thanks a lot in advance for any help!  PS. Right now I'm using winforms and not Asp.Net, but I guess the properties etc are the same regardless of platform. And I do VB.Net, BTW.

    /Pettrer, in chilly Sweden

     

    Friday, December 4, 2009 10:09 AM

Answers

All replies

  • User1925485754 posted

    Mitre, I believe comes from mitre joint, old woodworking terminology, anyway have a look at this:

    http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.linejoin.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, December 4, 2009 10:42 AM
  • User-296603942 posted

    Hi,

    Thanks for the link!

    It's funny, the day after I posted my question I watched the nice little movie called From Hell (starring Johnny Depp). I belive the mitres/miters were mentioned about twenty times, and a murder even took place at Mitre Square!

    /Pettrer

    Monday, December 7, 2009 4:41 AM