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

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2006
Posts: 14
Reputation: karhong is an unknown quantity at this point 
Solved Threads: 0
karhong karhong is offline Offline
Newbie Poster

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

 
0
  #1
Jul 25th, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 509
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 88
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

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

 
0
  #2
Jul 25th, 2008
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?
KSG
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 14
Reputation: karhong is an unknown quantity at this point 
Solved Threads: 0
karhong karhong is offline Offline
Newbie Poster

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

 
0
  #3
Jul 27th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 509
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 88
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

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

 
1
  #4
Jul 27th, 2008
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
  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.
KSG
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 14
Reputation: karhong is an unknown quantity at this point 
Solved Threads: 0
karhong karhong is offline Offline
Newbie Poster

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

 
0
  #5
Jul 27th, 2008
Thanks alot !!
it works out fine !!
Appreciate it !!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC