Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to add a larger cap to a line?

How to add a larger cap to a line?

Scheduled Pinned Locked Moved C#
questiontutorial
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    radic feng
    wrote on last edited by
    #1

    I want to add an arrow cap to a line. So I use pen.EndCap = LineCap.ArrowAnchor. But the arrow is so small. How can I add a larger one? I try to use CustomLineCap, It is so troublesome and I failed. Any advice? Regards! Radic

    D G 2 Replies Last reply
    0
    • R radic feng

      I want to add an arrow cap to a line. So I use pen.EndCap = LineCap.ArrowAnchor. But the arrow is so small. How can I add a larger one? I try to use CustomLineCap, It is so troublesome and I failed. Any advice? Regards! Radic

      D Offline
      D Offline
      Dario Solera
      wrote on last edited by
      #2

      AFAIK CustomLineCap is the only way. I know it is difficult to get it working. Maybe you can try to draw *manually* the arrow by filling a Shape.


      [ITA] Tozzi ha ragione: Gaia si sta liberando di noi. [ENG] Tozzi is right: Gaia is obliterating us.

      R 1 Reply Last reply
      0
      • D Dario Solera

        AFAIK CustomLineCap is the only way. I know it is difficult to get it working. Maybe you can try to draw *manually* the arrow by filling a Shape.


        [ITA] Tozzi ha ragione: Gaia si sta liberando di noi. [ENG] Tozzi is right: Gaia is obliterating us.

        R Offline
        R Offline
        radic feng
        wrote on last edited by
        #3

        I thought the manual way. But you know the slope of the line changes sharply and the arrow has to change. So it needs much calculation work and I doubt if the effect is good. Radic

        D 1 Reply Last reply
        0
        • R radic feng

          I thought the manual way. But you know the slope of the line changes sharply and the arrow has to change. So it needs much calculation work and I doubt if the effect is good. Radic

          D Offline
          D Offline
          Dario Solera
          wrote on last edited by
          #4

          Another RAW way: 1. draw the line only (without arrows) 2. apply a scale to the Graphics object (ScaleTransform) 3. Draw a short line (few pixels long) with the default arrow cap. you should try and try to get the correct scale and 2nd line's length. :cool:


          [ITA] Tozzi ha ragione: Gaia si sta liberando di noi. [ENG] Tozzi is right: Gaia is obliterating us.

          1 Reply Last reply
          0
          • R radic feng

            I want to add an arrow cap to a line. So I use pen.EndCap = LineCap.ArrowAnchor. But the arrow is so small. How can I add a larger one? I try to use CustomLineCap, It is so troublesome and I failed. Any advice? Regards! Radic

            G Offline
            G Offline
            Guffa
            wrote on last edited by
            #5

            In what way is the CustomLineCap class troublesome? I think that it probably is the easiest way to do it, so any other method would be even more troublesome. --- b { font-weight: normal; }

            R 1 Reply Last reply
            0
            • G Guffa

              In what way is the CustomLineCap class troublesome? I think that it probably is the easiest way to do it, so any other method would be even more troublesome. --- b { font-weight: normal; }

              R Offline
              R Offline
              radic feng
              wrote on last edited by
              #6

              Any easier way? Before you construct a CustomLineCap, you need construct GraphicsPath, FillMode, etc, which, I think, is troublesome. Will you be kind enough to show me an easier way? Thanks, thanks, thanks! Radic

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups