|
-
Jul 11th, 2008, 04:20 PM
#1
Thread Starter
Member
[2008] TabControl....Tabs with Close Buttons?
I've got a bunch of TabPages inside a TabControl; I'd like to have an easy way for the user to close individual tabs; kinda like IE or FireFox does with their tabs.
Can I do that using the default Windows Control, without too much work?
-
Jul 11th, 2008, 09:40 PM
#2
Re: [2008] TabControl....Tabs with Close Buttons?
Hi,
You can try something like this:
vb Code:
Imports System.Drawing Imports System.Windows.Forms Public Class Form1 Inherits Form Private tabControl1 As TabControl Private tabPage1 As TabPage Private button1 As Button Public Sub New() Me.tabControl1 = New TabControl() Me.tabPage1 = New TabPage() Me.button1 = New Button() Me.tabControl1.TabPages.Add(tabPage1) Me.tabControl1.Location = New Point(25, 25) Me.tabControl1.Size = New Size(250, 250) ' Gets the controls collection for tabPage1. ' Adds button1 to this collection. Me.tabPage1.Controls.Add(button1) Me.button1.Text = "button1" Me.button1.Location = New Point(25, 25) Me.ClientSize = New Size(300, 300) Me.Controls.Add(tabControl1) End Sub Shared Sub Main() Application.Run(New Form1()) End Sub End Class
Wkr,
sparrow1
-
Jul 11th, 2008, 10:17 PM
#3
Re: [2008] TabControl....Tabs with Close Buttons?
Placing a button on the tabs of a TabControl is not the same thing as placing a Button control on each TabPage.
The tabs are actually part of the TabControl itself, not each TabPage. As such you would have to owner-draw the tabs and draw your own button.
http://www.vb-helper.com/howto_net_ownerdraw_tab.html
-
Jul 12th, 2008, 03:03 AM
#4
Frenzied Member
Re: [2008] TabControl....Tabs with Close Buttons?
Great link, I found it very useful myself. Thanks
Please rate helpful ppl's posts. It's the best 'thank you' you can give 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|