title: Adding close button in tabpage tab caption in C# Windows Form
body: <p>I am trying to add close button or 'X' on tabpage panel in tabcontrol and I have successfully done this by reading this <a href="https://stackoverflow.com/questions/3183352/close-button-in-tabcontrol">stackoverflow question</a>. </p>
  
  <p>The problem is the tabbed page title and X sign is merged together. I discovered that the tabpage title panel is not resizing according to title text.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>//This code will render a "x" mark at the end of the Tab caption. 
  e.Graphics.DrawString("X", e.Font, Brushes.Black, e.Bounds.Right + 15, e.Bounds.Top + 4);
  e.Graphics.DrawString(this.tabControl1.TabPages[e.Index].Text, e.Font, Brushes.Black, e.Bounds.Left+5, e.Bounds.Top + 4);
  
  e.DrawFocusRectangle();
  </code></pre>
  
  <p>The result which comes is here I have changed <code>e.bounds.right</code> value but still it's not working.</p>