Resolve an Issue with Common Controls in a Windows App
We have an issue in a Windows application. The app was originally built with Visual Studio 2005. Migration was done to a new development environment (and from x86 to x64). The problem is that visual interface elements such as buttons now look a bit different. We need help with determining why it happened and with a fix.
Let's see what the problem is first. This is how the buttons look in the original application on Windows 7.
Original buttons with rounded corners
And here is how new buttons look. You can see that the app lost nice rounded corners.
New buttons are not rounded
Is the problem specific to Windows 7 only? Let's try Windows 8.
Original buttons on Windows 8
New buttons on Windows 8
How about Windows 10?
Original buttons on Windows 10
New buttons on Windows 10
As we can see, the buttons look different on all the above mentioned operating systems. Apparently, customer is looking at attempting to recover the original look, if possible.
According to this
, it looks like the problem may be related to an application manifest. If we examine the original application manifest, we can see this:
The new app uses automatically-generated manifests (by Visual Studio 2015). It could be our problem that needs fixing.
An alternative way to using a manifest is a compiler directive, as explained in the above mentioned article. Let's try to include something like this in one of our source files.
#pragma comment(linker,"\"/manifestdependency:type='win32' \
name='Microsoft.Windows.Common-Controls' version='188.8.131.52' \
processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
It turns out that the above fixes our problem.
However, for a cleaner fix, one should probably create a manifest file anyway. This gets us a single clearly documented place for all things that belong in there.
You can leave a comment
on this project, or post a new project