title: WinForms Textbox Changing its margins?
body: <p>So I've been working on cobbling together a game and decided I'd like to have a little program to show a file with each character replaced by its byte equivalent for working with coding saves and whatnot. Figured it'd a layup. Three hours later, I've been wracking my brain trying to figure this out.</p>
  
  <p>When I load a small (or perhaps short is the better term) file it looks like the window on top. When I load a larger file, it looks like the window on the bottom.<br>
  <a href="http://dl.dropbox.com/u/16985121/Images/ViewAsBytes.PNG" rel="nofollow">http://dl.dropbox.com/u/16985121/Images/ViewAsBytes.PNG</a></p>
  
  <p>That's 10pt Courier New, but it seems to happen with any font I try. There's always that extra column, and if there wasn't enough room for the column, it'd just squeeze in whatever it could in that space that it previously didn't use. I've tried tweaking all kinds of variables, as well as comparing the textbox before and after it adds the text from the file (which is read in just as bytes from a FileStream and then fed into a StringBuilder) but nothing seems to change even though something is clearly different.</p>
  
  <p>I can think of a bunch of different workarounds for this, but now I'm just more interested in what TextBox thinks it's doing exactly than getting my program done. Anyone got any idea?</p>
  
  <p>Here's the code that reads in the data and puts that to the textbox:</p>
  
  <pre><code>FileStream stream = new FileStream(files[0], FileMode.Open);
  
  StringBuilder sb = new StringBuilder();
  
  int byteIn = stream.ReadByte();
  while (byteIn != -1)
  {
      sb.Append('[');
  
      if (byteIn &lt; 100)
          sb.Append('0');
      if (byteIn &lt; 10)
          sb.Append('0');
  
      sb.Append(byteIn.ToString());
  
      sb.Append(']');
  
      byteIn = stream.ReadByte();
  }
  
  txtView.Text = sb.ToString();
  
  stream.Close();
  </code></pre>