15,877,857 members
3.00/5 (1 vote)
See more:
I am looking forward to make a rosette using c# graphics...
Here is what I'm trying to achieve:
If someone can give me some lines of code and show me how this is done, I'll appreciate it. :)
Posted
Kenneth Haugland 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 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.

—SA
Sergey Alexandrovich Kryukov 8-Apr-13 9:45am
It looks like a very simple exercise. What did you try so far?
—SA

## 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

kastriotlimani 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 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