close tabs in TabControlAdv like in IE7
is there a way to embed an "x" button on tabs, so that they can be closed like pages are closed in IE7?
SIGN IN To post a reply.
6 Replies
RC
Rajesh C
Syncfusion Team
April 26, 2007 02:58 AM UTC
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
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
IG
Inna Golovataya
August 2, 2007 06:58 PM UTC
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,
Can you recommed the way to implement Close button in version 4.1.0.58?
Thank you,
AJ
Ajish
Syncfusion Team
August 6, 2007 07:36 PM UTC
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.
JE
JeePee
February 28, 2008 08:20 PM UTC
Can you provide full code that can work with 4.1.0.58 version. I tried hard but could nto make it work
JE
JeePee
February 29, 2008 04:25 PM UTC
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
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
AD
Administrator
Syncfusion Team
March 5, 2008 09:39 PM UTC
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 [email protected].
Please let me know if you have any problem in this version.
Thanks,
Nagaraj
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 [email protected].
Please let me know if you have any problem in this version.
Thanks,
Nagaraj
SIGN IN To post a reply.
- 6 Replies
- 6 Participants
-
KY Kamen Yotov
- Apr 25, 2007 06:16 PM UTC
- Mar 5, 2008 09:39 PM UTC