SaveToMetaFile behaviour in Display scaling 125%

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

SaveToMetaFile behaviour in Display scaling 125%

Post by vinc64 » Sun Jan 03, 2016 4:04 pm

Hi,

If in Windows 10 I change the Display scaling to 125% (which is the default value) and use chart.SaveToMetaFile() the file is created with some extra space making the chart smaller. If I change the Windows 10 Display scaling to 100% the chart is saved correctly, see attachment for the two cases. How can I get the SaveToMetaFile with 125% scaling not to create that extra white space around the chart?

Thanks for any help or pointers.
Attachments
charts.zip
Two charts saved as metafile
(5.78 KiB) Downloaded 593 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: SaveToMetaFile behaviour in Display scaling 125%

Post by Yeray » Mon Jan 04, 2016 12:51 pm

Hello,

This issue sounds very similar to this:
http://www.teechart.net/support/viewtop ... =3&t=15815

If you still find problems with it don't hesitate to let us know arranging a simple example project we can run as-is to reproduce the problem here.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: SaveToMetaFile behaviour in Display scaling 125%

Post by vinc64 » Mon Jan 04, 2016 2:23 pm

I added a custom manifest as explained in the link you provided but it didn't change the behaviour of savetometafile. I have created a simple test application that shows the issue. Set the Display scaling to 100% and start the test app. When you click on the Save-button it will create a file chart.wmf, rename this file to something else, e.g. chart_100.wmf. Change the display scaling to 125% and then click on the save button again. When you now check chart.wmf you will see that the file has extra whitespace (at least that's what I'm experiencing, see also chart_100%.wmf and chart_125%.wmf).
Any idea what else I could try?
Attachments
test.zip
(20.38 KiB) Downloaded 595 times

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: SaveToMetaFile behaviour in Display scaling 125%

Post by vinc64 » Mon Jan 04, 2016 2:24 pm

I forgot to mention that I'm using Delphi 2009 and Teehchart 8.08.

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: SaveToMetaFile behaviour in Display scaling 125%

Post by Yeray » Tue Jan 05, 2016 10:47 am

Hello,

Taking the manifest from the Delphi Developers Guide 4K.pdf in the article here and adding it to your project in RAD Studio 10 Seattle creates a .res that makes the application to also behave correctly in a 125% scale even when compiled in RAD XE.
Find the project with that .res, compiled with RAD XE and the results here:
testMetaScaling.zip
(932.4 KiB) Downloaded 647 times
However, I've tried to follow these guides (1, 2) to generate a working .res from the same manifest above directly using RAD XE but I'm afraid I haven't succeeded. So I'm afraid I can't give you the exact instructions to achieve it, even if it seems it should be possible.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

vinc64
Newbie
Newbie
Posts: 30
Joined: Fri Jan 23, 2009 12:00 am

Re: SaveToMetaFile behaviour in Display scaling 125%

Post by vinc64 » Tue Jan 05, 2016 1:33 pm

Hi, thanks for your help. I found a component (at http://issamsoft.com/en/Default.aspx) which allows you to edit the manifest file also under Delphi 2009. If I use the manifest below the charts are saved with the correct scaling. The only negative side-effect I noticed is that a TPanel I'm using in my main form is now dark gray instead of light gray (but it's a small issue)

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
 <dependency>
   <dependentAssembly>
     <assemblyIdentity
       type="win32"
       name="Microsoft.Windows.Common-Controls"
       version="6.0.0.0"
       publicKeyToken="6595b64144ccf1df"
       language="*"
       processorArchitecture="*"/>
   </dependentAssembly>
 </dependency>
 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
   <security>
     <requestedPrivileges>
       <requestedExecutionLevel
         level="asInvoker"
         uiAccess="false"/>
       </requestedPrivileges>
   </security>
 </trustInfo>
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
    <dpiAware>true</dpiAware>
  </asmv3:windowsSettings>
</asmv3:application>
</assembly>

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: SaveToMetaFile behaviour in Display scaling 125%

Post by Yeray » Thu Jan 07, 2016 8:37 am

Hi,

I'm glad to hear you found a way to make it work as you wish!
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply