jeudi 1 août 2019

Numbering coordinates and drawstring from left to right

Im trying to number blobs using the rectangle COG of objects. But the rectangles are in an elliptical path, hence im not getting it in a proper sequence.

        Font annotationFont = new Font("Verdana", 12, FontStyle.Bold);
        Pen annotationPen = new Pen(Color.FromName("White"), 2.5f);

        Graphics g = imageBoxMain.CreateGraphics();
        for (int i = 0; i < totalrectcount; i++)
        {
            Rectangle rect = new Rectangle(arrayX[i] /* blobid[i].name.Length * 6)*/, imageBoxMain.Image.Height - arrayminY[i]- 6, 100, 20);

            g.DrawString(Convert.ToString(i + 1), annotationFont, annotationPen.Brush, new System.Drawing.Point(rect.X, rect.Y));
        }

This is what im getting :

enter image description here

I want the rectangles to be labelled from left to right.

Aucun commentaire:

Enregistrer un commentaire