Search code examples
c#visual-studiowinformscompact-frameworkwindows-ce

C# WinForms: How to set Button BackColor?


[Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE]

Why does button1.BackColor = Color.Green work in the Visual Studio emulator, but not on the windows CE 5.0 target?


Solution

  • The platform has the Skinnable UI OS component (SYSGEN_XPSKIN) built into it. The skin behavior overrides the behavior of setting the control color, so any color change you try to implement is unseen. Your options are to do a user control where you draw your own button or to see if the OEM has an OS image that doesn't include the skin (this is assuming you don't have a way to change the OS yourself, in which case a third option of creating your own skin would be available too).

    I thought there was a registry key to turn this off, but I can't find it and I don't have a device with the skinnable UI in the OS to test. You might play around with the device registry to see if there actually might be one, but I'm not saying that there definitely is one - only that there might be.