title: c# printing - how do you define rectangles height when string size unknown
body: <p>I have code that prints a till receipt which includes users string, the string is not fixed the user can type more or even less, thus i am not sure about the height, i have made a rectangle to print the users string and the height will be the amount of letters in the string, it works but when the string has more characters the receipt has a big white gap before it prints the string so basically not the right way.
  this is the code that i have tried</p>
  
  <pre><code>graphics.DrawString("CONDITIONS OF SALE", bold2, Brushes.Black, 77, 70 + offX);//prints as stated
  
  // after printing the string on top there is a big white space here. this is the issue.
  
  SALE = dr2["PRINTMESSAGESALE"].ToString(); //gets string from database
  
  var r = new Rectangle(2, 5 + offX, 275, SALE.Length); //rectangle that prints the string
  </code></pre>