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.
Syncfusion Feedback

TabControlAdv DrawItem

Thread ID:

Created:

Updated:

Platform:

Replies:

69042 Oct 10,2007 10:09 PM UTC Oct 19,2007 10:23 PM UTC Windows Forms 3
loading
Tags: Tools
Julie Levy
Asked On October 10, 2007 10:09 PM UTC

Hi -
I am using the DrawItem event to set a gradient background to the tabstrip area outside of the tabs. The problem is that it only draws the active tab page's tab at the top, not the inactive one. When i click in the general area of the inactive tab, then it appears, but the other one is gone. How can i always draw both? The style is Office2003. My code is below.
Thanks,
Julie

void tbBody_DrawItem(object sender, DrawTabEventArgs drawItemInfo)
{

Rectangle TabControlArea = tbBody.ClientRectangle;
Rectangle TabArea = tbBody.DisplayRectangle;
Rectangle topStrip = new Rectangle(TabControlArea.X, TabControlArea.Y,
TabControlArea.Right, TabControlArea.Height - TabArea.Height);
Brush br = new LinearGradientBrush(topStrip, Color.White, System.Drawing.Color.FromArgb(187, 194, 214), System.Drawing.Drawing2D.LinearGradientMode.Vertical);
drawItemInfo.Graphics.FillRectangle(br, topStrip);
br.Dispose();

drawItemInfo.DrawBackground();
drawItemInfo.DrawBorders();
drawItemInfo.DrawInterior();

}

Julie
Replied On October 11, 2007 08:00 PM UTC

Any response

Jisha Joy [Syncfusion]
Replied On October 15, 2007 08:09 AM UTC

Hi Julie,

Thank you for using Syncfusion Products.

The issue can be solved by using the inbuilt method GetTabRect of TabControlAdv to get the tab rectangle and we can use it in the LinearGradientBrush and FillRectangle methods. Here is the code snippets:

void tabControlAdv1_DrawItem(object sender, Syncfusion.Windows.Forms.Tools.DrawTabEventArgs drawItemInfo)
{
Brush br = new LinearGradientBrush(this.tabControlAdv1.GetTabRect(drawItemInfo.Index), Color.White, System.Drawing.Color.FromArgb(187, 194, 214), System.Drawing.Drawing2D.LinearGradientMode.Vertical);
drawItemInfo.Graphics.FillRectangle(br, this.tabControlAdv1.GetTabRect(drawItemInfo.Index));
br.Dispose();
drawItemInfo.DrawBackground();
drawItemInfo.DrawBorders();
drawItemInfo.DrawInterior();

}


Please refer the sample that illustrates this:

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

Please try this and let me know if this helps.

Regards,
Jisha

Julie Levy
Replied On October 19, 2007 10:23 PM UTC

thanks, i'll try it out.

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.

Warning Icon 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.Close Icon

;