I’m need to create this shape in WPF. First, I thought is a path, but the lines inside shows is a 3D shape.
How can I draw this shape including the lines?
Thanks a lot.

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The outside/outline of your shape can be drawn pretty simply with Path and Ellipse objects. The top face of the cylinder can also be drawn with a number of lines (as Path objects) in a grid. You can just draw them so they all extend outside the top ellipse and use the top ellipse as a Mask to trim them.
The vertical lines in the body of the cylinder are a little bit more complicated. Their coordinates can be determined by the following formula, assuming the left edge of the cylinder is at x=0 and the point where the left edge of the cylinder meets the left edge of the ellipse is y=0:
where
NumberOfDivisions + 1is equal to the number of lines that you want to show up on the cylinder.MSDN has some good examples for getting started with the Path class.
If all you need is just a way to represent a 3D-looking cylinder, without the gridlines, a linear gradient brush and 2 path objects will do the trick:
EDIT
Ok, this questions intrigued me enough that I went to the trouble of writing a complete article for it on CodePoject, along with the source code for a simple project to draw the solution. Normally, I wouldn’t go to that much trouble, but this was a nice simple project for me to start learning C#.