Closed energyuser closed 5 years ago
Try setting the AutoScaleMode of the Form like this:
AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
This is also possible from within the PropertyGrid via the designer.
Did you read my entire issue description? In it there's things I've tried, and setting AutoScaleMode is one of those things. It didn't work.
Maybe you need to use a manifest file and tell windows that your application is DPI aware.
Put the following file with the name app.manifest in your app root and select this file in the properties of your project as the manifest file.
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="Game4"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on and is
is designed to work with. Uncomment the appropriate elements and Windows will
automatically selected the most compatible environment. -->
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
</windowsSettings>
</application>
</assembly>
@sqrMin1 Sorry for the late reply.
Yes! Adding that manifest really fixed it. If I remove the manifest, a 100x100 texture will be drawn as a 125x125 texture (1.25 scale). In fact the whole window would be scaled, not just the texture.
Is there any way to fix that from within the library? If not, you should add it as a warning in the README.md for future users...
Thanks again.
If I remove the manifest, a 100x100 texture will be drawn as a > 125x125 texture (1.25 scale). In fact the whole window would be scaled, not just the texture.
This is not comming from the library. This is the regular Windows DPI scaling system.
Is there any way to fix that from within the library?
In this case adding a manifest file to the project is the right solution and you should go with that.
you should add it as a warning in the README.md for future users
Good idea. I added the specific information in the "Tips&Tricks-section" of the readme.md file.
Thank you for your suggestion and i'm glad I could help you with your problem.
Have a nice day!
So I have a texture which I'm drawing in a MonoGameControl. The texture is 48x48 pixels, but when I open the form it is drawn in a 59x59 size, and is noticeably blurry. You can download and zoom these images for reference:
Normal Scaled
This happens with any texture I draw. I have a MonoGame (latest develop branch) project. I draw the same texture and it is drawn correctly.
What I've tried:
-Setting
Editor.graphics
's backbuffer width and height to the size of the control on the form -Setting the zoom of Camera to 1.0f -Form.AutoScaleMode =AutoScaleMode. None;
-Form.DoubleBuffered = false;
My Environment: C# 7.3 Visual Studio 2019 .NET Framework 4.8