title: Graphics.DrawString doesn't work
body: <p>I want to draw a text over a PictureBox in a foreach loop. This is the code that is responsible for rendering(GG is a PictureBox that is currently in the loop)</p>
  
  <pre><code>if (GG != null)
        {
              ((PictureBox)GG).Image = (Image)obj;
              using (Graphics g = ((PictureBox)GG).CreateGraphics()) {
              g.DrawString(i["amount"].ToString(), kryptonRichTextBox1.Font, 
              new SolidBrush(Color.Gold), new Point(16, 18));
        }
  
  }
  </code></pre>
  
  <p>But sadly, the text is not rendered. If I comment out the</p>
  
  <pre><code>//((PictureBox)GG).Image = (Image)obj;
  </code></pre>
  
  <p>line, it does work! I have no idea how to get it to work. </p>
  
  <p>I wanted to use the TextRenderer, but I don't know how to get an IDeviceContext of a control(and all examples I see on the internet use PaintEventArgs.Graphics in Paint event).</p>
  
  <p>Also, if this is relevant, the GG PictureBox is a child of another picturebox, and has a transparent background.</p>
  
  <p>I tried to refresh the box after invalidating, the working code:</p>
  
  <pre><code>if (GG != null)
        {
              ((PictureBox)GG).Image = (Image)obj;
              ((PictureBox)GG).Invalidate();
              ((PictureBox)GG).Refresh();
              using (Graphics g = ((PictureBox)GG).CreateGraphics()) {
              g.DrawString(i["amount"].ToString(), kryptonRichTextBox1.Font, 
              new SolidBrush(Color.Gold), new Point(16, 18));
        }
  
  }
  </code></pre>