The essence of the problem is this: I have an array of objects. Each object has a numeric value and a PictureBox
component (it is created dynamically for each object). Each PictureBox
has a picture on the background, which is set in the constructor.
this.Card.Image = Image.FromFile("Card.png");
When I click on the PictureBox
I want it to display another picture, and on top of it, it will display the pixel value corresponding to this object. I have the code:
public void OpenCard() { this.Card.Image = Image.FromFile("CardOpen.png"); this.Card.BackColor = Color.Transparent; Graphics g = Graphics.FromHwnd(this.Card.Handle); g.DrawString(this.Value.ToString(), new Font("Arial", 35), Brushes.Blue, new Point(0, 20)); g.Dispose(); }
However, when pressed, the picture changes, but there is no number image. No one can help me solve this problem?
this.Card.Image
.this.Card.Image
.this.Card.Image
? Maybe it was worth putting this picture as BackGround? - Specter