filling a segment of a circle?

fguihen

Well-known member
Joined
Nov 10, 2003
Messages
248
Location
Eire
i am drawing a circle in C# using the drawEllipse() method. i want to fill a segment of it, but i just cant do it. the fillEllipse method just fills an ellipse of the specified size. i ftied the drawCurve inside a loop and kept looping until the co ordinates were the same as the sentre point of the circle, but no joy. anyone got any ideas??
 
at the moment i would suggest just draw the ellipse and then draw over it so that only the needed segment is visible, but if you want to have a segment like a cake then i would suggest using math (sin and cos)

maybe you have a picture or an example what you want to paint then i can go on helping you
 
yea, il prob have to use the sin and cos stuff, which i wont be able to do as im terrible at maths so looks like il have to find a different solution to make my little pie chart . thanks
 
you missunderstood me, i said i am going to help you at the cos and sin math, this is also a good training for me, i try to create an image which will show you how you can implement it yourself, it isnt that difficult, but i can tell you that you get the x coords with sin and the y coords with cos, it is like a circle, just wait for my image, will take some time to do that :)
 
ah omg that hurts i spend about 2-3 hours to write a tutorial, but now i see that DrawPie Method at the Graphics object, which is the solution for your Problem ...

Nevertheless i give you now the order to look at it :)


TUTORIAL:


Welcome to my little math lesson :)


[Broken External Image]:http://www.dotlike.com/tempweb/circle.jpg

This is a circle, you see the Y line, X line, R (radius) line and the angle Phi (greek symbol)

First you have to know that we normally use radian angles that mean 360
 
Back
Top