[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 457
  • Last Modified:

click on different resolution

how can I click a coordinate in different resolutions?
example I have coordinated 800x600 want more picks coordinated in 1024x800 resolution?
0
skiuia
Asked:
skiuia
  • 2
1 Solution
 
Sinisa VukCommented:
Something like this....
function GetScaledViewPoint(MousePt: TPoint; rScreenSizeOrg, rScreenSizeDest: TSize): TPoint;
begin
  Result.X := MulDiv(MousePt.X, rScreenSizeDest.cx, rScreenSizeOrg.cx);
  Result.Y := MulDiv(MousePt.Y, rScreenSizeDest.cy, rScreenSizeOrg.cy);
end;
....

pt := GetScaledViewPoint(Types.Point(14,356), Types.Point(800,600), Types.Point(1024,800));

Open in new window

0
 
skiuiaAuthor Commented:
[DCC Error] Unit1.pas(38): E2010 Incompatible types: 'tagSIZE' and 'TPoint'
0
 
Sinisa VukCommented:
Sorry this is just example of calling in one line. You can use variables of Tsize type or use typecast.

pt := GetScaledViewPoint(Types.Point(14,356), TSize(Types.Point(800,600)), TSize(Types.Point(1024,800)));

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now