Page 1 of 2
Problems with EMF files on Surface Pro
Posted: Wed Nov 09, 2016 1:25 pm
by 16478485
We have a program that has worked flawlessly for 10 years through Windows XP, 7, 8, and 10. But now when we run it on a Surface Pro under Win 10, the graphs are only visible in 1/4 of the space that they were previously. It is as if the EMF is prepared with the correct "canvas" size, but the chart itself is only created in 1/4 of the space (1/2 of each of the dimensions).
We found some examples on the web that use Chart.Export, but Export is not known in our release of the TeeChart software (7.12).
Any thoughts/help would be appreciated
Re: Problems with EMF files on Surface Pro
Posted: Thu Nov 10, 2016 1:15 pm
by Marc
Hello,
We don't have instant access to a Surface to try this out but can setup a test sometime over the next few days. In the meantime, if your program can recognise machine/sysop type, would it be possible increase the size of the image proportionally as a temporary workaround?
Regards,
Marc Meumann
Re: Problems with EMF files on Surface Pro
Posted: Thu Nov 10, 2016 2:29 pm
by yeray
Hello,
Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Re: Problems with EMF files on Surface Pro
Posted: Fri Nov 11, 2016 2:40 am
by 16478485
Your request is reasonable. I will try to get to this in the next few days.
Jon
Re: Problems with EMF files on Surface Pro
Posted: Fri Nov 11, 2016 11:18 am
by yeray
Hello,
In addition to the simple example project, we'd appreciate if we could get some extra information such as:
- What Surface Pro are you running?
- What Windows 10 build are you running?
- Have you tried to generate the emf files in a different machine and open the emf file in your Surface Pro?
Re: Problems with EMF files on Surface Pro
Posted: Fri Nov 11, 2016 8:25 pm
by 16478485
I have attached a ZIP file containing the following:
1) SurfaceProTestDelphi.ZIP: this contains the source code for the test program
2) Two PNG files, showing screen shots on both my Development VM (Dev VM, Win 7) and the Surface Pro 3 (Win 10). The left part of each screen shot shows the running test program, while the right part shows how Paint sees the EMF. Note the extra white space on the Surface Pro
3) Two EMF files, the two EMF files which were generated (one under Win 7 and one under Win 10 on the Surface Pro).
The Surface Pro is a Surface Pro 3 running Windows 10 Pro 64 with dual 1.9 GHz processor and 4 GB of RAM. It is fully updated.
Let me know how else I can help you understand the bug.
Jon
Re: Problems with EMF files on Surface Pro
Posted: Mon Nov 14, 2016 10:49 am
by yeray
Hello Jon,
Your test application generates a correct .emf for me here in a Windows 10 machine.
However, if I open the "SurfaceProTest on Surface Pro.EMF" file in Paint I see it has a wrong height and width, as in your "Surface Pro Test on Surface Pro.png" screenshot.
So it looks as if the Surface Pro 3 was taking a wrong TRect from the "function TCustomTeePanel.GetRectangle:TRect;". But it's hard to say without reproducing (and debug) the problem here.
You could try forcing a repaint before creating the .emf to see if it makes any difference.
Code: Select all
procedure TForm1.FormShow(Sender: TObject);
//...
Draw;
SaveToMetaFileEnh(fName);
RunAppByDocument(fName);
end;
end;
Re: Problems with EMF files on Surface Pro
Posted: Mon Nov 14, 2016 2:57 pm
by 16478485
Adding the Draw does not change the behavior of the program on the SurfacePro
Jon
Re: Problems with EMF files on Surface Pro
Posted: Tue Nov 15, 2016 1:23 pm
by yeray
Hello Jon,
I'm afraid we couldn't get a Surface Pro 3. And it's difficult to see what's exactly happening without a device where the problem can be reproduced.
Can I ask you to add this code to check what rectangle is the Surface using?
Code: Select all
with Chart1 do begin
//...
Title.Caption:='GetRectangle: '+
IntToStr(GetRectangle.Right-GetRectangle.Left)+'x'+
IntToStr(GetRectangle.Bottom-GetRectangle.Top);
I guess it will give 590x651 while it gives 393x433 on the desktop. This is a ratio of x1.5
You could also try GetClientRect instead of GetRectangle, to see it if gives the same result:
Code: Select all
with Chart1 do begin
//...
Title.Caption:='GetClientRect: '+
IntToStr(GetClientRect.Right-GetClientRect.Left)+'x'+
IntToStr(GetClientRect.Bottom-GetClientRect.Top);
Re: Problems with EMF files on Surface Pro
Posted: Tue Nov 15, 2016 8:37 pm
by 16478485
Here are the results for Win 7 and for the Surface Pro Win 10
Re: Problems with EMF files on Surface Pro
Posted: Wed Nov 16, 2016 2:30 am
by 16478485
We have borrowed a Surface Pro to use for testing. We will have to return it at the end of the day on Friday. So, after that, I will be unable to respond to requests for changes in the test software.
Re: Problems with EMF files on Surface Pro
Posted: Wed Nov 16, 2016 9:31 am
by yeray
Hello,
I'm sorry, I'm afraid the code I suggested for GetClientRect is retrieving the TRect of the form, not of the TChart. Please use this instead:
Code: Select all
type TWinControlAccess=class(TWinControl);
//...
Title.Caption:='GetRectangle: '+
IntToStr(GetRectangle.Right-GetRectangle.Left)+'x'+
IntToStr(GetRectangle.Bottom-GetRectangle.Top);
Title.Caption:=Title.Caption+'; GetClientRect: '+
IntToStr(TWinControlAccess(Chart1).GetClientRect.Right-TWinControlAccess(Chart1).GetClientRect.Left)+'x'+
IntToStr(TWinControlAccess(Chart1).GetClientRect.Bottom-TWinControlAccess(Chart1).GetClientRect.Top);
Re: Problems with EMF files on Surface Pro
Posted: Wed Nov 16, 2016 1:12 pm
by 16478485
This is the Surface Pro result using the new source code you provided.
Re: Problems with EMF files on Surface Pro
Posted: Thu Nov 17, 2016 12:35 pm
by yeray
Hello,
These results make me think again there must be some scaling issue. And I see some changes are giving problems to some devices:
https://blogs.technet.microsoft.com/ask ... ary-update
Could you please tell us what exact Windows 10 build is the Surface Pro 3 using?
Re: Problems with EMF files on Surface Pro
Posted: Thu Nov 17, 2016 12:49 pm
by 16478485
Version 1607 Build 14393.0, but we first saw this on another Surface Pro from China, so I doubt that the exact OS build is important in reproducing this bug.