Respecting XP themes when designing WinForms UI - winforms

How do you deal with the different XP themes when designing a WinForms UI? Do you avoid hard coded color values or just accept that your UI will not look good on non standard themes?
For instance, I have a light blue gradient panel that looks good against the standard control background color but would clash with other custom themes. What's a good approach to take?

Avoid hex colors and colors with names like "White" or "Green". The color picker for most objects should be able to show you colors with names like "ActiveWindow" or "ForegroundText". Those are the colors you want to be using. They are available via code also, and you want to choose them so that the names have some relationship to how they're used. For example, don't set "ForegroundText" as your background color just because you want a black background. If you have a gradient, then use those colors to build the gradient. Also, there's an event you may need to handle for when the theme changes.
That's if you choose to respect the themes. If you have a really out-there interface then you may want to specify your own colors. In that case, never use the windows colors, because they won't be reliable and you might end up with something real ugly. That means you'll need to go and change all the defaults in the standard controls, but if you're doing this you probably have your own controls anyway.
In summary, the thing to remember is that it's an all or nothing shot: either respect themes and always use colors defined based on Windows widget elements, or don't use themes and never use those colors at all.

Related

Is there a quick way to find out where the colours for an MUI component is coming from?

When experimenting with the theme I often want to try to set the colour of a specific part of a component to a different colour. For example, the inner, grey, borders for a DataGrid component.
If I want to do this across the entire app, the generally best method seems to be to use the palette to set the colour, making it so that any other similar scenario will use that same colour. (Supposing there was a "lite" data-grid that uses the grey borders, for example.)
However, finding out what part of the palette that component involves a huge amount of trial and error, changing all parts of the palette to bright colours until finally the component I'm looking at changes. This is especially time consuming if it turns out that the colour doesn't come from the palette at all.
I've not found any mention on the documentation about what palette colours a component uses.
Is there some way I can easily find out where the colour for a part of a component's coming from?

Is it possible to change colour palette on a per window / user control basis?

I am wondering if with the Telerik WPF library it is possible to change colour palette on a per window / usercontrol basis.
For clarity, I am not refering to basic Foreground or Background colours, I am interested in changing colours for certain visual states such mouse over or focused which is not possible to simple change on a control.
In the docs there is a sample for changing a colour palette such as FluentPalette.Palette.BasicColor = (Color)ColorConverter.ConvertFromString("#33000000");.
But this will have an effect on the whole app UI, whereas I am aiming to change the palette on a per window basis.
The way it looks to me, the only option would be to copy the specific theme for each variant (if that's possible at all) each with its colour palette tweaks for each window, which is of course overkill.
Any ideas?

How to scale down the UI size in ExtJS crisp theme

Comparing Extjs crisp and classic themes, apart from styling, the there is a difference with size / scale of ui.
The Crisp theme looks its zoomed up 110% of classic.
Is it possible to scale down the size of crisp theme to that of classic ?
I realize that with styling comes padding, borders and image sizes which would be set for compoentns under each theme.
But i would still like to know if scaling down the size is possible ?
Thanks in advance
Yes, the font size is larger (13px in crisp, 12px in classic), plus each them is using a different font scheme, which will add a bit of a difference as well.
To your question of scaling down the font size, the answer, of course, is yes this is possible. You could go down a bad road of creating a bunch of CSS rules to override what's already in crisp, and that would certainly work.
However, the better option would be to create your own theme altogether. You could create a theme that extends crisp, and then simply tweak the various areas that you want to be different (font sizes, paddings on different components, etc). If you do this, keep in mind that the crisp theme extends the neptune theme, while classic only extends neutral (which neptune also extends). I say this because if you look at the actual crisp theme, it's pretty bare in terms of the things you're looking to tweak (padding, margins, etc). That's because the majority of these derive from the neptune theme, so you'll probably do yourself a favor to become acquainted with both themes in order to most efficiently achieve the result you're after.
If you've not done a custom Ext JS theme before, be sure to check out the guide here: http://docs.sencha.com/extjs/5.0/core_concepts/theming.html. This guide also has a nice chart that illustrates the theme inheritance for the default theme packages, so be sure to take a look at that as well.
Hope that helps!

Can't change backcolor of TabPage with DevExpress WinForms XtraTab

I'm using a DevExpress WinForms XtraTab control v11.2 and I can't get the tab page background color to change. It's stuck on transparent. I've set colors on the XtraTab's AppearancePage.PageClient and there was no effect.
If you throw a default XtraTabControl out you get two tabs that are both white in the main area. I want this area to be grey.
In addition to what you're doing, set the XtraTabControl's PaintStyleName to Standard or PropertyView or one of the other non-Default styles to get the look you want:
Here's an example of dragging in the XtraTabControl and only changing the PaintStyleName property:
If the control's look and feel is set as skin then from what I'm aware you can't change the backcolor.
In order to actually do so you have two options:
1) Use devexpress SkinEditor utility to create a skin with the colors you want.
2) Set default look and feel to false, the style to flat, then you will be able to choose what color you want (keep in mind since you will be disabling the skin it won't look as good so the first option might be better).
this.xtraTabControl1.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Flat;
this.xtraTabControl1.LookAndFeel.UseDefaultLookAndFeel = false;
this.xtraTabControl1.TabPages[0].BackColor = System.Drawing.Color.Gray;

WPF Colour Picker/Wheel with Multiple Selection

I am looking for a free WPF Colour Picker/Wheel which has the ability to allow multiple colour selections. Does anything like this exist. The ones I have seen allow only one colour to be selected. I want to be able to easily select two or three colors.
Take a look at color wheel for silverlight (you can adapt it for wpf): http://asyrovprog.host22.com/colorwheel.html. Source code is located here: timeline.codeplex.com.

Resources