Click here to Skip to main content
15,921,697 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to devlop a game.I am using picture box,and want to display numbers on the Picture Box.I am using the following code,But the string is not being displayed on the picture box.
C#
PictureBox pb = new PictureBox();
pb.Parent = panel1;
Graphics g = pb.CreateGraphics();
g.DrawString("1", new Font("Arial", 10), Brushes.Black, new Point(100, 700));
pb.Size = size;
pb.Visible = true;
pb.Location = new Point(i + (i * 70), j + (j * 70));
pb.Visible = true;
pb.AllowDrop = true;


Please let me know where am I going wrong?
Posted
Updated 30-Oct-11 23:59pm
v2
Comments
RaisKazi 31-Oct-11 5:59am    
Edited: Added "pre" tag.

 
Share this answer
 
Try writing this code in the Paint event of the Picture box.
Here[^] is a very simple example.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900