Reputation: 2666
Does someone know how I could extend and TabPage so that there is a X visible on an active tab, that when pressed, closes the tab /ask if the tab should be closed ?
Thanks
Upvotes: 1
Views: 1235
Reputation: 941277
Use the TabControl.DrawMode property to implement custom drawing. There's a good example of a DrawItem event handler in the MSDN Library article. Use Graphics.DrawLine() or DrawImage to draw the x. Use the MouseUp event to detect a click on the x. You'll need the GetTabRect() method to find out which tab was clicked. And narrow down the location to verify that it was near the x.
Upvotes: 2