如何在另一个之前插入标签页 [英] How do i insert a tabpage before another one

查看:109
本文介绍了如何在另一个之前插入标签页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我已经制作了一个带有标签的网页浏览器

现在我想要的是一个新的标签按钮插入该按钮之前的另一个标签页

i知道您可以使用此代码执行此操作

Hi,

i''ve made an web browser with tabs
now what i want is a new tab button that inserts another tab page before that button
i know you can do this with this code

Me.customtabcontrol1.TabPages.Insert(Me.customtabcontrol1.TabCount - 1, "Newtab" & Me.customtabcontrol1.TabCount, "New")



但是我有包含另一个Form2的标签页。 vb作为一个控件

你有什么想法我可以修复它所以它插入tabpagepage with form2.vb在tabpage之前我用作按钮



这是我用来添加标签的代码:




but i''ve got tabpages that contain another Form2.vb as a control
do you have any ideas how i can fix it so it inserts the tabpage with the form2.vb before the tabpage i use as a "button"

this is the code i use to add a tab:

Dim t As New TabPage
Dim newtab As New tab
newtab.Show()
newtab.WebKitBrowser2.Navigate(url)
newtab.TopLevel = False
newtab.Dock = DockStyle.Fill
customtabcontrol1.Dock = DockStyle.Fill
customtabcontrol1.ContextMenuStrip = ContextMenuStrip1
t.Controls.Add(newtab)
customtabcontrol1.Controls.Add(t)





最好的问候,

Bart de Lange



best regards,
Bart de Lange

推荐答案

永远不要将表单用作其他控件的子控件。使用类似面板的东西。



您已经知道如何插入标签页。在大多数情况下,您还需要显示新创建的标签页。为此,请使用以下属性之一:

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.tabindex.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol .tabpages.aspx [ ^ ]。



-SA
Never ever use a form as a child control of some other control. Use something like a Panel.

You already know how to insert a tab page. In most cases, you also need to show the newly created tab page. For this purpose use one of these properties:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.tabindex.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.tabpages.aspx[^].

—SA


这篇关于如何在另一个之前插入标签页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆