How does one prevent theming on plugins?

I have written a plugin for Mission Planner which displays a form with various information on it. I want the form and its components to have visual styles (such as colours etc.) which differ from those of the Mission Planner theme. However, whenever I open the form, visual styles I have set are overridden by the theme. I see that the ApplyTheme() method in the ThemeManager is called recursively so all components and their children have the theme applied to them.

Is there a way to prevent this behaviour from occurring in a plugin?

Not without changing Mission Planner code.

If you add a check for a property in ThemeManager then add that property in your form in plugin.
Something like this.

        public static void ApplyThemeTo(Control control)
        if (control is ContainerControl)
            ((ContainerControl)control).AutoScaleMode = AutoScaleMode.None;

        if (control.GetType().GetProperty("ignoreTheme") != null) return;

        ApplyTheme(control, 0);

Then add public bool ignoreTheme { get; set; } to your form.

If you need this function, feel free to send in a PR.

Thanks! I have submitted a PR.