StrataFrame Forum

Apply theme properties to custom control

http://forum.strataframe.net/Topic25318.aspx

By Alex Bibiano González - 12/2/2009

I have a custom control inherited from another control.

I want to apply to this custom some SF ThemeProperties to integrate it with the SF themed controls.

What’s the best approach to do it?

I have tried to do it on to constructor with this code:

public MyUIPanelManager()
            : base()
        {
            this.TabbedMdiSettings.TabStripFormatStyle.BackColor = ApplicationTheme.ThemeProperties.ThemeFormBorderGradientBegin;
            this.TabbedMdiSettings.TabStripFormatStyle.BackColorGradient = ApplicationTheme.ThemeProperties.ThemeFormBorderGradientEnd;
        }

But I get a runtime error:

ApplicationException
  An error occurred while creating the main form
TargetInvocationException
  Se produjo una excepción en el destino de la invocación.
NullReferenceException
  Referencia a objeto no establecida como instancia de un objeto.
 
Source     : MicroFour StrataFrame UI
 
Stack Trace:
   en Test.MyUIPanelManager..ctor() en D:\Privado\Test\Test\MyUIPanelManager.cs:línea 13
   en Test.Form1.InitializeComponent() en D:\Privado\Test\Test\Form1.Designer.cs:línea 36
   en Test.Form1..ctor() en D:\Privado\Test\Test\Form1.cs:línea 18
   en System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
   en System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
   en System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
   en System.Activator.CreateInstance(Type type, Boolean nonPublic)
   en System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   en System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   en MicroFour.StrataFrame.Application.StrataFrameApplication.RunApplication()