Inheriting DockRenderer

Bars for Windows Forms Forum

Posted 12 years ago by Adam King
Version: 2.0.0083
Avatar
Hi,

I am trying to define an alternative dock renderer, so I can create a couple of different options for 'skins' and easily use different ones in different parts of my program, however my code doesn't work!!

Here I am trying to set the toolbar window's tab pane to be black, so it can go on my black form. I'd rather not do this with the designer, and realise I could do it in code elsewhere, but I'd quite like to figure this out:

using System;
using System.Collections.Generic;
using System.Text;
using ActiproSoftware.Drawing;

namespace ActiproSoftware.UIStudio.Dock
{
    public class ChameleonGraphicRenderer : Office2003VisualStudio2005Beta2DockRenderer
    {

        new public SolidColorBackgroundFill AutoHideTabStripPanelBackgroundFill {

            get { return new SolidColorBackgroundFill(System.Drawing.Color.Black); }
            set { } // Would rather be able to access parent set, can I just omit this?
        }

    }
}
and then in my form I use:

this.dockManager1.DockRenderer = new ActiproSoftware.UIStudio.Dock.ChameleonGraphicRenderer();
Do I maybe need a constructor for this?

Comments (7)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Adam,

Here's the better way to do it which might fix your problem. This is a sample of overriding the TabbedMdiWindowBackgroundFill value.
/// <summary>
/// Resets the <see cref="VisualStudio2002DockRenderer.TabbedMdiWindowBackgroundFill"/> property to its default value.
/// </summary>
public override void ResetTabbedMdiWindowBackgroundFill() {
    this.TabbedMdiWindowBackgroundFill = new SolidColorBackgroundFill(colorScheme.FormBackGradientEnd);
}
/// <summary>
/// Indicates whether the <see cref="VisualStudio2002DockRenderer.TabbedMdiWindowBackgroundFill"/> property should be persisted.
/// </summary>
/// <returns>
/// <c>true</c> if the property value has changed from its default; otherwise, <c>false</c>.
/// </returns>
public override bool ShouldSerializeTabbedMdiWindowBackgroundFill() {
    return (this.TabbedMdiWindowBackgroundFill == null) || !(this.TabbedMdiWindowBackgroundFill.Equals(
        new SolidColorBackgroundFill(colorScheme.FormBackGradientEnd)));
}
If you do that sort of thing then you don't worry about overriding get/setters.


Actipro Software Support

Posted 12 years ago by Adam King
Avatar
I see what you're doing there, but I'm confused as to where to put it?
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Just take out this sort of code:
new public SolidColorBackgroundFill AutoHideTabStripPanelBackgroundFill {
And put it right there. Since you are overriding the default values you do it in your renderer class.


Actipro Software Support

Posted 12 years ago by Adam King
Avatar
I thought as much, but with this new code nothing happens?
Am I missing something fundamental?

using System;
using System.Collections.Generic;
using System.Text;
using ActiproSoftware.Drawing;

namespace ActiproSoftware.UIStudio.Dock
{
    public class ChameleonGraphicRenderer : Office2003VisualStudio2005Beta2DockRenderer
    {

        public override void ResetAutoHideTabSelectedBackgroundFill()
        {
            this.AutoHideTabStripPanelBackgroundFill = new SolidColorBackgroundFill(System.Drawing.Color.Black);
        }

        public override bool ShouldSerializeAutoHideTabSelectedBackgroundFill()
        {
            return (this.AutoHideTabStripPanelBackgroundFill == null) || !(this.AutoHideTabStripPanelBackgroundFill.Equals(
                    new SolidColorBackgroundFill(System.Drawing.Color.Black)));
        }

    }
}
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Remember that the autohide selected bg only shows in some cases. So it might be working but perhaps you don't have the scenario to see it. Maybe trying something more prominent like an active tool window title bar background.


Actipro Software Support

Posted 12 years ago by Adam King
Avatar
Ok, so the method works, I have tested it.

I am confused however by your statement about the autohide strip's background colour.

Why is this only available some of the time, and in any case, why did the change to this property in the designer work, but not when applied in a hard-coded way?

Thanks for your help so far!!

[Edit:]

Oops, typo in the final code, shows what a new day can bring!!

[Modified at 04/04/2007 03:52 AM]
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Oops, sorry. I was wrong about the auto-hide selected bg color. Ignore that part of my post. :)

So are you working ok now?


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.