Results 1 to 9 of 9

Thread: [RESOLVED] Close Tab Button on tab: Is it possible?

  1. #1

    Thread Starter
    Fanatic Member Emcrank's Avatar
    Join Date
    Jan 2009
    Posts
    566

    Resolved [RESOLVED] Close Tab Button on tab: Is it possible?

    Is it possible to get a little X on a tab like this
    Name:  Capture.JPG
Views: 517
Size:  11.9 KB
    I can do the removing the tab part myself but i dont know if its possible and if it is how to put a button on a tab.
    Thankyou in advance

  2. #2
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Close Tab Button on tab: Is it possible?

    You have to custom-draw the tabs... I think I saw a CodeBank entry, but maybe not.

    You could also use my custom-draw XTabControl but it doesn't work very well unless you add controls at runtime, not design time (it turns out that locking them makes it so you can't put controls in them...).

  3. #3

  4. #4
    Stack Overflow mod​erator
    Join Date
    May 2008
    Location
    British Columbia, Canada
    Posts
    2,824

    Re: Close Tab Button on tab: Is it possible?

    Oh, good
    Here it is. You'll need to create a new header renderer (I explain how in the thread), then handle some events.

    Post 14 is the tutorial.

  5. #5
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: Close Tab Button on tab: Is it possible?

    Hi,

    You can find a tutorial how to create a Owner drawn Tabcontrol, here.
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Close Tab Button on tab: Is it possible?

    Yet another useful link for the TabControl:

    http://dotnetrix.co.uk/tabcontrol.htm
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: Close Tab Button on tab: Is it possible?

    I also know of several free third party tabcontrols that have close buttons, but I can't find them anymore so quickly. Shouldn't be too hard to find though. One thing I noticed is that none of them really look very good, and none of them use the windows theme that the user is using at that time. I've searched around for a bit and I can't figure out how to draw a tab header in the system theme style. I don't think it's possible

  8. #8
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Close Tab Button on tab: Is it possible?

    You may have a look at my codebank article that does exactly this:
    TabControl with Close button on TabPages (with Design-Time support)

    Let me know if you have any concerns.
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  9. #9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width