vendredi 17 avril 2015

adding close button in tabpage tab caption in c# windows form

hello friends I am trying to add close button or 'X' on tabpage panel in tabcontrol and I have successfully done this by reading one of the stackoverflow question Close button in tabControl but 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 here is the 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();


the result which comes is here I have changed e.bounds.right value but still its not working


Aucun commentaire:

Enregistrer un commentaire