TabControlAdv DrawItem
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();
}
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();
}
SIGN IN To post a reply.
3 Replies
JU
Julie
October 11, 2007 08:00 PM UTC
Any response
JJ
Jisha Joy
Syncfusion Team
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:
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
JL
Julie Levy
October 19, 2007 10:23 PM UTC
thanks, i'll try it out.
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
JL Julie Levy
- Oct 10, 2007 10:09 PM UTC
- Oct 19, 2007 10:23 PM UTC