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. Draw a UML inherit shape use with GDI+

Draw a UML inherit shape use with GDI+

Scheduled Pinned Locked Moved C#
winformsgraphicsquestion
4 Posts 2 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.
  • D Offline
    D Offline
    dreamwinter
    wrote on last edited by
    #1

    The shape have a line and a empty triangle that joined the end of the line. Can you give me some code?Thanks!:doh:

    C 1 Reply Last reply
    0
    • D dreamwinter

      The shape have a line and a empty triangle that joined the end of the line. Can you give me some code?Thanks!:doh:

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I think you want this: e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; GraphicsPath capPath = new GraphicsPath(); Point[] cappoints = new Point[] { new Point(0, 10), new Point(-10, 0), new Point(10, 0), new Point(0, 10) }; capPath.AddLines(cappoints); CustomLineCap myCap = new CustomLineCap(null, capPath); Pen capPen = new Pen(Brushes.Black, 1); capPen.CustomEndCap = myCap; capPen.CustomStartCap = myCap; myCap.StrokeJoin = LineJoin.Round; myCap.WidthScale = 2; e.Graphics.DrawLine(capPen, new Point(100, 100), new Point(300, 100)); Christian Graus - Microsoft MVP - C++

      D 2 Replies Last reply
      0
      • C Christian Graus

        I think you want this: e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; GraphicsPath capPath = new GraphicsPath(); Point[] cappoints = new Point[] { new Point(0, 10), new Point(-10, 0), new Point(10, 0), new Point(0, 10) }; capPath.AddLines(cappoints); CustomLineCap myCap = new CustomLineCap(null, capPath); Pen capPen = new Pen(Brushes.Black, 1); capPen.CustomEndCap = myCap; capPen.CustomStartCap = myCap; myCap.StrokeJoin = LineJoin.Round; myCap.WidthScale = 2; e.Graphics.DrawLine(capPen, new Point(100, 100), new Point(300, 100)); Christian Graus - Microsoft MVP - C++

        D Offline
        D Offline
        dreamwinter
        wrote on last edited by
        #3

        Hi,brother.Thanks for your help!:->

        1 Reply Last reply
        0
        • C Christian Graus

          I think you want this: e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; GraphicsPath capPath = new GraphicsPath(); Point[] cappoints = new Point[] { new Point(0, 10), new Point(-10, 0), new Point(10, 0), new Point(0, 10) }; capPath.AddLines(cappoints); CustomLineCap myCap = new CustomLineCap(null, capPath); Pen capPen = new Pen(Brushes.Black, 1); capPen.CustomEndCap = myCap; capPen.CustomStartCap = myCap; myCap.StrokeJoin = LineJoin.Round; myCap.WidthScale = 2; e.Graphics.DrawLine(capPen, new Point(100, 100), new Point(300, 100)); Christian Graus - Microsoft MVP - C++

          D Offline
          D Offline
          dreamwinter
          wrote on last edited by
          #4

          Can you tell me why set cappoints variable like this way.If I changed the array of the points,the line will not anchor the middle point of the bottom line triangle.Because I am a beginner in GDI+,please help me in any case.Thanks a lot!;)

          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