943,696 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 3601
  • C# RSS
Jul 25th, 2008
0

creating shape like circle or oval(i wanted to design my own circle shape)

Expand Post »
Hi,

I'm trying to draw circle and oval by myself without using ".addEllipse"
Can I draw it by pointer? which mean i point 4 point and then make it to become the shape of circle and oval.
I tried to find solution in the net, but i dont seems to get any solution.

Any Idea?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
karhong is offline Offline
14 posts
since Aug 2006
Jul 25th, 2008
0

Re: creating shape like circle or oval(i wanted to design my own circle shape)

Do you want to implement the Circle, or Line Drawing Algorithm instead of using Graphics.DrawLine(), DrawEllipse () Method?

Or

You want to make application like paint ? rubberband elastic Drawing?
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008
Jul 27th, 2008
0

Re: creating shape like circle or oval(i wanted to design my own circle shape)

Actually, I created other shape such as trapezium, parallelogram, by using the addlines.

I created them by having a middle point of the shape start from (x,y) - (100,100)

but when i straight use the build in function to draw ellipse, i can't find any ways to set the mid point of the ellipse start from (100,100)

I do that is because when the user need to change from one shape to another, the position of it wont be changing because all of the shape started from 100,100

Any idea of drawing my own ellipse so that i can start from position 100,100 ??
Any help would be very appreciated
Reputation Points: 10
Solved Threads: 0
Newbie Poster
karhong is offline Offline
14 posts
since Aug 2006
Jul 27th, 2008
1

Re: creating shape like circle or oval(i wanted to design my own circle shape)

Hi, You can perform the Transformation on your Points(By just adding or subtracting (100, 100) to each points). GDI+ uses (0,0) is the Mid point. But it provides Matrix class to Transform the Coordinate System.

Example to Transform the Coordinate System
C# Syntax (Toggle Plain Text)
  1. private void Form1_Paint(object sender, PaintEventArgs e)
  2. {
  3. Graphics g = e.Graphics;
  4. Rectangle rect = new Rectangle (0,0,100,100);
  5. Matrix matrix = new Matrix();
  6.  
  7. g.DrawEllipse(Pens.Blue, rect);
  8. matrix.Translate(100, 100);
  9. g.Transform = matrix;
  10. g.DrawEllipse(Pens.Green, rect);
  11. }

Here first Circle will be drawn Blue color and (0,0) as the starting point
Second circle will use the Transformation and (100,100) as the starting Point

I think this may helpful to you
Last edited by selvaganapathy; Jul 27th, 2008 at 12:47 pm.
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008
Jul 27th, 2008
0

Re: creating shape like circle or oval(i wanted to design my own circle shape)

Thanks alot !!
it works out fine !!
Appreciate it !!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
karhong is offline Offline
14 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: how to convert from PDF to WORD
Next Thread in C# Forum Timeline: ListBox C#





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC