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. Image for the cookie policy date

TabbedMdiManager Backcolor

Hi,

I want to have a gradient style on the tabbed mdi manager in the area behind the tabs. Is there any chance to custom paint the background? I use SF Suite 4.2.

Thanks in advance,
Christian


7 Replies

J. J.Nagarajan Syncfusion Team December 8, 2007 02:26 AM UTC

Hi Christian ,

Thanks for using Essential Tools.

The tabColor changing properties will work only for 2D, 3D,Workbook Mode, OneNoteStyle and OneNoteFlatTabs and not for other tabStyles like TabRendererWhidbey, TabRendererDockingWhidbey and TabRendererOffice2003.

You can also set tabColor using TabControlAdv''''s ActiveTabColor and InactiveTabColor and please note that when you are using TabPageAdv''''s TabBackColor, this color will override the above two color properties.

I here with attach a sample for setting TabBackColor when Tabstyles are enabled

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

Let me know if you have any questions.

Regards,
Nagaraj



CR Christian Rattat December 10, 2007 10:23 PM UTC

Hi,

I think I explained this incorrectly. I have attached a screenshot and marked the area I want to custom paint (or define a vertical gradient background for). I use a custom tab renderer.

Regards,
Christian



tabbedmdi.zip


J. J.Nagarajan Syncfusion Team December 11, 2007 12:37 AM UTC

Hi Christian ,

The part behind the tabs is MDITabPanel control . You can set the color for MDITabPanel using TabPanelBackColor property.

public class CustomTabbedMDIManager : TabbedMDIManager
{
public CustomTabbedMDIManager() : base()
{
}
protected override MDITabPanel CreateMDITabPanel()
{
MDITabPanel mdiTabPanel = base.CreateMDITabPanel();
// Change the tab control's back color
mdiTabPanel.TabPanelBackColor = Color.Pink;
return mdiTabPanel;
}
}

Please let me know if this helps you.

Regards,
Nagaraj



CR Christian Rattat December 11, 2007 09:13 AM UTC

Hi Nagarajan,

thanks for the info. This property sets the color of exactly the area I want to set. The only problem is that I need to have a vertical gradient painted in this area. Can i do this somehow?

Thanks,
Christian



J. J.Nagarajan Syncfusion Team December 12, 2007 12:33 AM UTC

Hi Christian ,

You could perform custom drawing on the TabPanel by following the steps below :

1. Derive from the TabPanelProperty (TabPanelProperty3D in this case) for the appropriate TabStyle


public class CustomTabPanelProperty : Syncfusion.Windows.Forms.Tools.TabPanelProperty3D
{
public override void OnPaintPanelBackground(ITabControl tabControl, Graphics g, Color bgColor, Rectangle bounds)
{
System.Drawing.Drawing2D.LinearGradientBrush lgb = new System.Drawing.Drawing2D.LinearGradientBrush(bounds, Color.FromArgb(235,235,244), Color.FromArgb(186,185,206), System.Drawing.Drawing2D.LinearGradientMode.Vertical);

g.FillRectangle(lgb, bounds);

}
}


2. Register the TabType with the TabRendererFactory


TabRendererFactory.RegisterTabType(TabRendererWhidbey.TabStyleName, typeof(TabRendererWhidbey), new CustomTabPanelProperty());

The attached sample demonstrates this behavior completely. Please refer to it and let me know if his meets your requirements.

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

Thank you for using Syncfusion products.

Regards,
Nagaraj




CR Christian Rattat December 12, 2007 09:19 AM UTC

Hi,

thanks once more, this works also ok excpeting one issue: The close button and the drop down button on the right side still have the tab background color. Can I also change this one?

Thanks,
Chrfistian



J. J.Nagarajan Syncfusion Team December 15, 2007 12:23 AM UTC

Hi Christian ,

Thanks for your continued interest in Syncfusion products.

To achieve this behavior you need to derive MDITabPanel class and override PaintCloseButton() method. Please refer to the attached sample that demonstrates this completely.

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

Please refer to the sample and let me know if you have any questions.

Thanks,
Nagaraj


Loader.
Live Chat Icon For mobile
Up arrow icon