Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# graphics drawing
I am looking forward to make a rosette using c# graphics...
Here is what I'm trying to achieve:
https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Academ_rosette.svg/630px-Academ_rosette.svg.png[^], of course not the lines outside the circle.
If someone can give me some lines of code and show me how this is done, I'll appreciate it. Smile | :)
Posted 8-Apr-13 4:33am
Comments
Kenneth Haugland at 8-Apr-13 9:40am
   
Draw one circle, and 5 other circles with the same radius as the original, and spaced at equal angles?
Sergey Alexandrovich Kryukov at 8-Apr-13 9:48am
   
Right, but I think OP's problem was clipping it all. Take a look at the picture: the lines are clipped by a non-rectangular region, probably my an ellipse.
 
I answered, please see:
 
—SA
Sergey Alexandrovich Kryukov at 8-Apr-13 9:45am
   
It looks like a very simple exercise. What did you try so far?
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This looks nothing more than 7 circles of the same size, which can be drawn using System.Drawing.Graphics.DrawEllipse:
http://msdn.microsoft.com/en-us/library/a3fd63x2.aspx[^].
 
You might see some problem in clipping of the lines by the round area. One of the method to achieve that is using the property System.Drawing.Graphics.Clip:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.clip.aspx[^].
 
You need to set a clip region by some region of elliptic shape of appropriate size and positioned in the center. To do so, create an instance of Region out of appropriate GraphicPath:
http://msdn.microsoft.com/en-us/library/yhfywt1c.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.graphicspath.aspx[^].
 
To obtain the instance of System.Drawing.Drawing2D.GraphicsPath you need, create one with its constructor and add an ellipse to it:
http://msdn.microsoft.com/en-us/library/tcy13d48.aspx[^],
http://msdn.microsoft.com/en-us/library/21sfy33s.aspx[^].
 
—SA
  Permalink  
Comments
kastriotlimani at 8-Apr-13 10:59am
   
Well, I realized that I need to know the coordinates of regular hexagon shape, then to join those points with same tension using Graphics.DrawCurve. But the problem is how to draw a regular hexagon first ...
Sergey Alexandrovich Kryukov at 8-Apr-13 11:04am
   
What's the problem, elementary school mathematics, or API? Why drawing a hexagon? You need to build hexagon points only, not the hexagon itself.
 
Or, do you think that a clipping region is a polygon? If so, see these constructors with array of points:
http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.graphicspath.aspx
 
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 210
2 BillWoodruff 205
3 Jochen Arndt 180
4 Sergey Alexandrovich Kryukov 165
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,650
3 Kornfeld Eliyahu Peter 3,460
4 Sergey Alexandrovich Kryukov 2,811


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 8 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100