Question

i tracer le cercle en utilisant c # directx.i attire le cercle de mêmes dimensions en utilisant c # GDI.It signifie i à convertir ce cercle de DirectX à GDI. Est-ce une aide du corps pour me.plz fournir la réponse pour me.how que je peux faire it.Is tout algorithme disponible pour cette ........ Et aussi je donne l'entrée pour le centre du cercle est (x, y) en ce point format.but dans RDB est le format de pixel .donc comment puis-je convertir les points de directx à + pixels gdi

Était-ce utile?

La solution

Voici un lien de MSDN qui introduit graphiques et le dessin dans Windows Forms . Et il est probable que vous aurez besoin de quelque chose de similaire à:

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

}

Après cela, vous pourriez vouloir regarder les techniques à double mémoire tampon, quelques liens:

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top