I wish to oONLY change the background color of ONE tab, not all of them. How do I accomplish this.
Even if I wish to change all of the "Backcolors" that does not work.
I would like code to change the color.
Can you provide me a demo with multiple tabs demonstrating how to change the color of a single tab a different color via code?
How to change the caption back color of a certain DockPanel when a panel is auto-hidden
Answers
As it is stated in the documentation, in Windows XP and any skinning painting scheme, only the Font and ForeColor properties are in effect. If you want to use the BarAndDockingController to change background colors, it is necessary to change the style to Flat via the BarAndDockingController.LookAndFeel.Style property and set the BarAndDockingController.LookAndFeel.UseDefaultLookAndFeel property to false.
The BarAndDockingController allows you to change the appearance of all DockPanels. To change the appearance of a certain DockPanel, use the DockPanel.Appearance property.
DockPanels do not provide settings to change the caption background color. To accomplish this task, use the approach demonstrated in the How to implement the custom draw functionality for skinned dock panels example.
Hello Harold,
Attached is a sample project demonstrating how to create your own paint style and paint auto-hidden panel headers manually by overriding the HideBarSkinPainter.DrawButtonHeaderBackground method.
Please let me know, if you need any further assistance.
Could you add one more dockpanel on the left and only color ONE of the two panel tabs when the panels are closed? That is the essesence of the problem.
Thanks
Harold
Hello Harold,
You can use the AutoHideButtonHeaderInfo.IsHot property to determine the state of the button header:
C#protected override void DrawButtonHeaderBackground(GraphicsCache cache, AutoHideButtonHeaderInfo headerInfo) {
if (headerInfo.IsHot)
base.DrawButtonHeaderBackground(cache, headerInfo);
else cache.FillRectangle(Brushes.Yellow, headerInfo.GetRelativeRect(headerInfo.Bounds));
}