如何将形状从Directx转换为gdi+;使用c#
我使用directx在c#中绘制圆。我喜欢使用GDI在c#中绘制尺寸相同的圆。这意味着我喜欢将该圆从directx转换为GDI。有人帮我吗?请告诉我答案。我该怎么做。有什么算法可以解决这个问题吗。。。。。。。。如何将形状从Directx转换为gdi+;使用c#,c#,directx,gdi+,C#,Directx,Gdi+,我使用directx在c#中绘制圆。我喜欢使用GDI在c#中绘制尺寸相同的圆。这意味着我喜欢将该圆从directx转换为GDI。有人帮我吗?请告诉我答案。我该怎么做。有什么算法可以解决这个问题吗。。。。。。。。 我也给出了圆心的输入,在这个点格式中是(x,y)。但在gdi中是像素格式。那么我如何将directx点转换为gdi+像素呢。而且,您可能需要类似于: public Form1() { InitializeComponent(); this.Paint += new Pa
我也给出了圆心的输入,在这个点格式中是(x,y)。但在gdi中是像素格式。那么我如何将directx点转换为gdi+像素呢。而且,您可能需要类似于:
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);
}
在这之后,您可能需要研究双缓冲技术,以下是几个链接: