Frage

i in den Kreis C # zeichnen wie mit directx.i den Kreis mit gleichen Abmessungen in C # Mitteln GDI.It i von DirectX GDI diesen Kreis konvertieren möchte zu ziehen. Ist jede Stelle Hilfe für me.plz die Antwort liefern für me.how i it.Is jeder Algorithmus für das tun kann ........ Und auch ich gebe den Eingang für die Mitte des Kreises ist (x, y) in diesem Punkt format.but in gdi es Pixelformat .so ist, wie kann ich die directx Punkte zu gdi konvertieren + Pixel

War es hilfreich?

Lösung

Hier ist ein Link von MSDN, dass einleitet Grafik und Zeichnen in Windows Forms . Und es ist wahrscheinlich, dass Sie etwas brauchen, wird ähnlich wie:

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

}

Danach Sie könnten in Double-Buffering Techniken aussehen wollen, ein paar Links:

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top