12,077,195 members (42,642 online)
Rate this:
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 8-Apr-13 4:33am
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?

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

It looks like a very simple exercise. What did you try so far?
—SA

Rate this:

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

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

Top Experts
Last 24hrsThis month
 Richard MacCutchan 340 Sergey Alexandrovich Kryukov 334 Jochen Arndt 325 OriginalGriff 245 F-ES Sitecore 195
 OriginalGriff 2,935 Dave Kreskowiak 2,836 Richard MacCutchan 2,174 CPallini 1,632 Sergey Alexandrovich Kryukov 1,445