Draw a UML inherit shape use with GDI+
-
The shape have a line and a empty triangle that joined the end of the line. Can you give me some code?Thanks!:doh:
-
The shape have a line and a empty triangle that joined the end of the line. Can you give me some code?Thanks!:doh:
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++
-
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++
Hi,brother.Thanks for your help!:->
-
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++
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!;)