我使用directx.i在c#中绘制圆圈,就像使用GDI在c#中绘制相同尺寸的圆圈。这意味着我想将该圆圈从directx转换为GDI。有没有身体对我有帮助.plz为我提供了答案。我能做到吗。我可以使用任何算法........ 而且我在这个点格式中给出了圆心的输入是(x,y)。但是在gdi中它是像素格式。所以如何将directx点转换为gdi +像素
答案 0 :(得分:3)
以下是MSDN中引入Graphics and Drawing in Windows Forms的链接。而且你可能需要类似的东西:
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);
}
之后你可能想要研究双缓冲技术,一些链接: