Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 2309

Summary: CopyToClipboardMetafile on system with Textscale > 100%
Product: VCL TeeChart Reporter: henry.ernst <henry.ernst>
Component: ChartAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED FIXED    
Severity: critical CC: marc, yeray
Priority: ---    
Version: 29.200113   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version: RAD 10.2 Tokyo
Attachments: Demo-Project for Reproduce

Description henry.ernst@snafu.de 2020-04-04 13:08:38 EDT
Dear Teechart-Team,

i use Delphi 10.2.3, Teechart Pro 2019.27.190530 VCL and Windows 10.0.18363.

The users of my software can copy a Chart to Clipboard.
To do this with "Chart1.CopyToClipboardMetafile(true);".

But on Devices with Textscaling more than 100% (i.e. Surfacebook 2 with 200%) there is an issue.
After pasting the graphic in Word or Powerpoint there is an frame for the hole graphic. But the content of the chart take only a part (i.e. quarter) from the frame.

You ca reproduce the problem with the attached sample.
Is ther any workaround or bugfix for this problem?

Thanks and regards Henry
Comment 1 henry.ernst@snafu.de 2020-06-02 11:55:50 EDT
Created attachment 939 [details]
Demo-Project for Reproduce
Comment 2 marc meumann 2020-06-02 12:18:58 EDT
Hello Henry,

We can offer you alternative code to achieve the CopyToClipboard.

Excerpt taken from this forum thread:
https://www.steema.com/support/viewtopic.php?f=3&t=15936#p70743


Code:
procedure TForm1.Button1Click(Sender: TObject);
var tmpRect: TRect;
    tmpWidth, tmpHeight: Integer;
begin
  tmpRect:=Chart1.GetRectangle;
  tmpWidth:=tmpRect.Right-tmpRect.Left;
  tmpHeight:=tmpRect.Bottom-tmpRect.Top;
  tmpRect.Right:=tmpRect.Right+tmpWidth;
  tmpRect.Bottom:=tmpRect.Bottom+tmpHeight;
  Chart1.CopyToClipboardBitmap(tmpRect);
end;

Regards,
Marc
Comment 3 yeray alonso 2020-06-03 03:25:47 EDT
You may want to "Enable High-DPI" in your project options, concretely under "Application".
In Rio and Sydney, more options where added and the preferred way to go is by using "Per Monitor v2" "DPI Awareness" under "Application/Manifest".

Setting this option, the given project seems to work fine without any extra code.