怎样才能标签页上添加按钮

怎样才能标签页上添加按钮

本文介绍了怎样才能标签页上添加按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有尝试一个完整的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

推荐答案

你想要做什么的。

要做到这一点,你需要创建一个的。

To do this, you would need to create a Custom Control.

在自定义的控制,你可以添加一个小和几个的控制。

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中的的来显示不同结果

CodeProject: FireFox-like Tab Control

这篇关于怎样才能标签页上添加按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 00:26