Pregunta

i dibujar el círculo en C # usando directx.i como para dibujar el círculo con mismas dimensiones en C # utilizando medios GDI.It i desea convertir ese círculo de DirectX para GDI. Es ninguna ayuda para el cuerpo me.plz proporcionar la respuesta para me.how puedo hacer yo it.Is cualquier algoritmo disponible para ese ........ Y también me dan la entrada para el centro del círculo es (x, y) en este punto format.but en GDI es formato de píxel .so ¿Cómo puedo convertir los puntos de DirectX para GDI + píxeles

¿Fue útil?

Solución

Aquí hay un enlace de MSDN que introduce Gráficos y Dibujo en Windows Forms . Y lo más probable es que usted va a necesitar algo similar a:

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);

}

Después de que es posible que desee ver en las técnicas de doble búfer, algunos enlaces:

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top