tags:

views:

168

answers:

1

Hi

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

+1  A: 

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.

Hans Passant