Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Help with getting Display Scaling work!

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
AmyGrrl
Cheater
Reputation: 0

Joined: 15 Dec 2016
Posts: 31

PostPosted: Sat Jun 15, 2024 1:33 pm    Post subject: Help with getting Display Scaling work! Reply with quote

When I save a trainer as an EXE and run it. The Display Scaling never works unless I set the High DPI Scaling Override to System on the EXE. I've tried a bunch of things and nothing seems to work. Is there some setting I need to enable to get this working without having to enable the Override? I've tried turning DPI Aware On/Off and set the main form Scaled to True/False. I would really like to get it working without having to enable the Override. Thanks!
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1516

PostPosted: Sat Jun 15, 2024 5:18 pm    Post subject: Reply with quote

Here's some examples and charts to get an idea.
Try correcting based on user display DPI.

Or test what results you get on different PCs.

And set our Trainer form to the DPI that is suitable for you.

Code:
myForm1.DesignTimePPI = 96
myForm1.PixelsPerInch = 96


Test Form:
Code:
print("Your Screen DPI: "..getScreenDPI())
DP1=getScreenDPI()/96

if myForm1 then myForm1.Destroy() myForm1=nil end
myForm1=createForm()
myForm1.PopupMode=0 myForm1.caption="Test DPI Form1"
myForm1.Position="poDesktopCenter" myForm1.ShowInTaskBar="stAlways"
myForm1.BorderStyle="bsSingle"

myForm1.DesignTimePPI = 96
myForm1.PixelsPerInch = 96
-------------------------
local UDF1 = {}
----------------------- UDF1.CEButton1 ----- 
UDF1.CEButton1=createButton(myForm1)
UDF1.CEButton1.AutoSize=false
UDF1.CEButton1.height=25 UDF1.CEButton1.width=75 UDF1.CEButton1.left=56 UDF1.CEButton1.top=57
UDF1.CEButton1.caption="Approx. 4K"
UDF1.CEButton1.Font.Style="fsBold" UDF1.CEButton1.Font.Size=9
-----------------------
----------------------- UDF1.CEButton2 ----- 
UDF1.CEButton2=createButton(myForm1)
UDF1.CEButton2.AutoSize=false
UDF1.CEButton2.height=45 UDF1.CEButton2.width=107 UDF1.CEButton2.left=129 UDF1.CEButton2.top=116
UDF1.CEButton2.caption="Your PC DPI: "..getScreenDPI()
UDF1.CEButton2.Font.Style="fsBold" UDF1.CEButton2.Font.Size=9
-----------------------
----------------------- UDF1.CEButton3 ----- 
UDF1.CEButton3=createButton(myForm1)
UDF1.CEButton3.AutoSize=false
UDF1.CEButton3.height=53 UDF1.CEButton3.width=123 UDF1.CEButton3.left=234 UDF1.CEButton3.top=185
UDF1.CEButton3.caption="DPI: 50"
UDF1.CEButton3.Font.Style="fsBold" UDF1.CEButton3.Font.Size=9
-----------------------
----------------------- UDF1.CEButton4 ----- 
UDF1.CEButton4=createButton(myForm1)
UDF1.CEButton4.AutoSize=false
UDF1.CEButton4.height=61 UDF1.CEButton4.width=131 UDF1.CEButton4.left=358 UDF1.CEButton4.top=267
UDF1.CEButton4.caption="DPI: 110"
UDF1.CEButton4.Font.Style="fsBold" UDF1.CEButton4.Font.Size=9
-----------------------

--############################################################################--
--############################################################################--


myForm1.height=400
myForm1.width=500

local formCompTbl = {}
local compIndex = 0

for l,k in pairs(UDF1) do
formCompTbl[#formCompTbl + 1] = UDF1[l].width
formCompTbl[#formCompTbl + 1] = UDF1[l].height
formCompTbl[#formCompTbl + 1] = UDF1[l].left
formCompTbl[#formCompTbl + 1] = UDF1[l].Top
formCompTbl[#formCompTbl + 1] = UDF1[l].Font.Size
end

function checkDPI()
local res = 0
compIndex = 0
 for l,k in pairs(UDF1) do
  res = 0
  for n,m in pairs(formCompTbl) do
   if res==0 then
     UDF1[l].width = formCompTbl[compIndex + 1] * DP1
     UDF1[l].height = formCompTbl[compIndex + 2] * DP1
     UDF1[l].left = formCompTbl[compIndex + 3] * DP1
     UDF1[l].Top = formCompTbl[compIndex + 4] * DP1
     UDF1[l].Font.Size = formCompTbl[compIndex + 5] * DP1
     compIndex = tonumber(compIndex) + 5
     res = 1
   end
  end
 end
end

UDF1.CEButton1.OnClick=function()
DP1=getScreenDPI()/72
myForm1.height=400 * DP1
myForm1.width=500 * DP1
checkDPI()
end

UDF1.CEButton2.OnClick=function()
DP1=getScreenDPI()/getScreenDPI()
myForm1.height=400 * DP1
myForm1.width=500 * DP1
checkDPI()
end

UDF1.CEButton3.OnClick=function()
DP1=getScreenDPI()/50
myForm1.height=400 * DP1
myForm1.width=500 * DP1
checkDPI()
end

UDF1.CEButton4.OnClick=function()
DP1=getScreenDPI()/110
myForm1.height=400 * DP1
myForm1.width=500 * DP1
checkDPI()
end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25778
Location: The netherlands

PostPosted: Sat Jun 15, 2024 5:52 pm    Post subject: Reply with quote

and when using rhe designer set autosize to true and always use anchors to describe each control.

e.g button1 has to be left of button 2, and button 2 is 50 pixels to the border of the form, etc...

that way autosize will know where to put the controls dealing with different dpi's for you

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites