We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

close tabs in TabControlAdv like in IE7

Thread ID:

Created:

Updated:

Platform:

Replies:

59982 Apr 25,2007 02:16 PM Mar 5,2008 04:39 PM Windows Forms 6
loading
Tags: Tools
Kamen Yotov
Asked On April 25, 2007 02:16 PM

is there a way to embed an "x" button on tabs, so that they can be closed like pages are closed in IE7?

Rajesh C [Syncfusion]
Replied On April 25, 2007 10:58 PM

Hi Kamen,

Thank you for using Syncfusion products.

The TabControlAdv has no direct property to display the close button for tabs. I have created a sample to achieve this feature by using the TabRendererBase class. Please refer to the code snippet.

[ C#]

TabRendererBase[] renders;

private void Form1_Load(object sender, EventArgs e)
{
renders=new TabRendererBase[this.tabControlAdv1.TabCount ];
for (int i = 0; i < this.tabControlAdv1.TabCount; i++)
{
renders[i] = this.tabControlAdv1.Renderer.Renderers[i] as TabRendererBase;
renders[i].ShowCloseButton = true;
}
renders[this.tabControlAdv1.SelectedIndex].HitCloseButton = true;
}

private void tabControlAdv1_MouseClick(object sender, MouseEventArgs e)
{
renders[this.tabControlAdv1.SelectedIndex].CloseButtonClicked = renders[this.tabControlAdv1.SelectedIndex].CloseButtonHitTest(new Point(e.X, e.Y));
if (renders[this.tabControlAdv1.SelectedIndex].CloseButtonHitTest(new Point(e.X, e.Y)))
this.tabControlAdv1.TabPages.RemoveAt(this.tabControlAdv1.SelectedIndex);
}

Please have a look at this sample and let me know if this helps you.

http://websamples.syncfusion.com/samples//Tools.Windows/F59982/main.htm

Regards,
Rajesh

Inna Golovataya
Replied On August 2, 2007 02:58 PM

I'm trying to follow the example for adding Close button to the tab. I'm using version 4.1.0.58 and TabRendererBase class does not have HitCloseButton property.

Can you recommed the way to implement Close button in version 4.1.0.58?

Thank you,

Ajish [Syncfusion]
Replied On August 6, 2007 03:36 PM


Hi Inna,

The following code of the TabRendererBase class can be used to do the same,

if (renders[this.tabControlAdv1.SelectedIndex].CloseButtonHitTest(new Point(e.X, e.Y)))
this.tabControlAdv1.TabPages.RemoveAt(this.tabControlAdv1.SelectedIndex);

and here is a sample for your reference,

Sample: http://websamples.syncfusion.com/samples/Tools.Windows/F59982_1/main.htm

Kindly take a look and let me know if this helps.

Regards,
Ajish.

JeePee
Replied On February 28, 2008 03:20 PM

Can you provide full code that can work with 4.1.0.58 version. I tried hard but could nto make it work


JeePee
Replied On February 29, 2008 11:25 AM

Any response?
I need to show the close button on the tabs. I don't want to draw it on draw item event, because it look ugly.

Any suggestions?

>Can you provide full code that can work with 4.1.0.58 version. I tried hard but could nto make it work




Administrator [Syncfusion]
Replied On March 5, 2008 04:39 PM

Hi Jeepee ,

Feature: Close button on each tabs in TabControlAdv like in IE7

We have implemented this feature in v.6.2.0.7 and the later versions.. I would like to recommend you to upgrade to this version.

http://www.syncfusion.com/downloads/product/build.aspx

Unlock key :
Please contact your Syncfusion Sales Representative or e-mail salessupport@syncfusion.com.

Please let me know if you have any problem in this version.

Thanks,
Nagaraj



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;