怎样才能标签页上添加按钮? [英] how can add button on tab page?
问题描述
我有尝试一个完整的Firefox在Windows窗体应用程序。我添加一些附加标签页,但不能一附近点击。我不知道贴在标签page.My编码部分的横按钮: -
I have try a complete firefox in windows form application. I add some add tab page but can't a close by click. I have no idea to paste a cross button on the tab page.My coding part is :-
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabControl1.SelectedTab.Text == "+")
{
AddNewTab();
}
foreach (Control item in tabControl1.SelectedTab.Controls)
{
if (item.GetType() == typeof(WebBrowser))
{
WebBrowser wb = (WebBrowser)item;
toolStripButton1.Enabled = wb.CanGoBack;
toolStripButton2.Enabled = wb.CanGoForward;
}
}
this.wb.DocumentTitleChanged += Browser_DocumentTitleChanged;
this.wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
}
我的封闭功能 -
private void tabPage1_Click(object sender, EventArgs e)
{
if (tabControl1.SelectedTab != null)
{
tabControl1.SelectedTab.Dispose();
}
}
此功能是通过双击关闭标签页,我想与按钮的帮助一样FireFox的工作,关闭标签页
this function is closed the tab page by double click , I want to closed the tab page with the help of button same as FireFox working
推荐答案
你想要做什么的 TabControl的。
要做到这一点,你需要创建一个的自定义控制。
To do this, you would need to create a Custom Control.
在自定义的控制,你可以添加一个小图片框用的<大骨节病> + 骨节病>的形象和上的的。 label.aspx相对=nofollow>标签和几个的面板控制。
In your custom control, you could add a small PictureBox with the image of a + and some text on a Label and several Panel controls.
code中的<大骨节病> + 骨节病>的单击事件打电话给你的收盘的技术。
Code the + Click Event to call your closing technique.
code中的标签的 Click事件来显示不同在表单的rel=\"nofollow\">与HTML页面
Code the Label's Click Event to show different Panels in your form with your HTML pages.
编辑:像布赖恩还跟下面指出的是,这里是如何做到这一点的$ C $的CProject一个很好的教程:
Like Brian was kind enough to point out below, here is an excellent tutorial on how to do this on CodeProject:
CodeProject: FireFox-like Tab Control
这篇关于怎样才能标签页上添加按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!