i draw the circle in c# using directx.i like to draw the circle with same dimensions in c# using GDI.It means i like to convert that circle from directx to GDI. Is any body help for me.plz provide the answer for me.how can i do it.Is any algorithm available for that........ And also i give the input for center of the circle is (x,y)in this point format.but in gdi it is pixel format .so how can i convert the directx points to gdi+ pixels
Asked
Active
Viewed 804 times
1
-
So, just as a clarification, you have the X,Y coordinates of he center of the circle, do you have the radius ? Is the center of the circle relevant, or do you simply want to have a similar shape ? – Dynami Le Savard Feb 06 '10 at 17:24
-
ya i have radius in double format – ratty Feb 08 '10 at 04:33
-
And where do you want to draw it ? – Dynami Le Savard Feb 08 '10 at 05:18
-
I'm going on a last wild shot here. Do you actually want to display DirectX output to a Winforms C# panel control ? – Dynami Le Savard Feb 09 '10 at 13:51
-
no i create the circle in directx coding in c# how can draw that in gdi i need just converting – ratty Feb 09 '10 at 17:40
-
Communication fails. Here are the facts : 1-You want to draw a circle. 2-You want to draw it in a Winform panel 3-You dont want to use GDI+ Graphics 4-You dont want to display DirectX in the panel. I'm sorry but it is just a cluster of contradictions here, like when you say `how can draw that in gdi` versus your comment `this is only for drawing in gdi i am not asking this` – Dynami Le Savard Feb 09 '10 at 18:19
-
Can you post the source code concerning DirectX circle drawing you have at the moment? – Li0liQ Feb 09 '10 at 21:22
-
thank you for your response "Dynami le savard" we draw circle in directx using small lines only.but in gdi we have special function so only i put the question here – ratty Feb 10 '10 at 05:30
-
Smells like homework to me. @ratty, you are going to give up 50 rep for the bounty regardless of whether you accept the answer or not. It would be in your best interest to help these people help you!!! – IAbstract Feb 11 '10 at 22:58
1 Answers
3
Here is a link from MSDN that introduces Graphics and Drawing in Windows Forms. And it's likely that you will need something similar to:
public Form1()
{
InitializeComponent();
this.Paint += new PaintEventHandler(Form1_Paint);
// This works too
//this.Paint += (_, args) => DrawCircle(args.Graphics);
}
void Form1_Paint(object sender, PaintEventArgs e)
{
DrawCircle(e.Graphics);
}
private void DrawCircle(Graphics g)
{
int x = 0;
int y = 0;
int radius = 50;
// The x,y coordinates here represent the upper left corner
// so if you have the center coordinates (cenX, cenY), you will have to
// substract radius from both cenX and cenY in order to represent the
// upper left corner.
// The width and height represents that of the bounding rectangle of the circle
g.DrawEllipse(Pens.Black, x, y, radius * 2, radius * 2);
// Use this instead if you need a filled circle
//g.FillEllipse(Brushes.Black, x, y, radius * 2, radius * 2);
}
After that you might want to look into double-buffering techniques, a few links :

Community
- 1
- 1

Dynami Le Savard
- 4,986
- 2
- 26
- 22
-
-
3So, you ask for bananas, but don't want bananas. I can give you alot of things that aren't bananas... – Dynami Le Savard Feb 09 '10 at 13:50