Bonjour tout le monde,
Je suis en train de manipuler les picturebox en c# et je me trouve devant un probleme. J eplace differentes positions en cliquant sur ma carte (chaque position est enregistree dans une base de donnees et est constituee de ses coordonnees x,y et d'un numero attribue). Ensuite j'affiche bien cette nouvelle position sur la carte mais je n'arrive pas a afficher le numero qui lui est associe dans la base de donnee. En fait je ne sais pas comment faire l'equivalent du pDC->Textout sur une picturebox en c# .
J'ai un mechant bug, je ne vois pas d'ou ca vient. Voici mon code si quelqu'un pouvait m'aider:
Bitmap bmp =
new Bitmap(pictureBox_map.Image, pictureBox_map.Image.Size);
pictureBox_map.Image.Dispose();
//liberation des ressources
Graphics g = Graphics.FromImage(bmp);
Pen pen =
new Pen(
new SolidBrush(Color.Black));
g.DrawRectangle(pen,
int.Parse(row["x"].ToString()),
int.Parse(row["y"].ToString()),5,5);
string drawString = "5";
System.Drawing.Font drawFont =
new System.Drawing.Font("Arial", 16);
System.Drawing.SolidBrush drawBrush =
new System.Drawing.SolidBrush(System.Drawing.Color.Black);
System.Drawing.StringFormat drawFormat =
new System.Drawing.StringFormat(StringFormatFlags.DirectionVertical);
g.DrawString(drawString, drawFont, drawBrush,
int.Parse(row["x"].ToString()),
int.Parse(row["y"].ToString())-5, drawFormat);
drawFont.Dispose();
drawBrush.Dispose();
g.Dispose();