Visual Studio 2010 - WPF - Background Image Scaling Issues
I got a problem in Visual Studio 2010 and I don't know if there was an error or I was just wrong.
I have 6 images (Icons), which are the same size (50x60px), of the same type (png), made with the same program (gimp), saved with the same parameters. I want to use these icons as background for buttons. But images are scaled differently, although Stretch and TileMode are "None".
Some of them are big, some are small, some are just right. And I'm not talking about a pixel or so. They are more than half as large, or nearly double what they should be. I tested it with Button, Canvas and Rectangle controls.
But when I open the Select Image window or edit the photos in Visual Studio, they are the same size. The problem exists in the designer and in the compiled program.
Can anyone confirm this behavior? Does anyone know how to fix this?
a source to share
There are not many candidates for this problem. But one thing: the bitmap records the resolution of the device it was created on. Typical defaults are 96 or 120 dpi on a Windows machine. WPF will scale the image on the target device to be the same size, measured in inches, not pixels.
It looks like your editor is incapable of not recording DPI correctly. You can see it in the mspaint.exe file using the Properties command.
a source to share