Blueman Posted December 28, 2016 Posted December 28, 2016 (edited) Hey Guys, I am Struggling with a issue that i cannot seem to fix. I hope that you guys can help me with this. I have a GUI with some text attributes, for all i use the following code; $Label_ts_Header = GUICtrlCreateLabel("Manual Adress", 60, 10, 500, 50) GUICtrlSetBkColor($Label_ts_Header, $COLOR_WHITE) GUICtrlSetFont ($Label_ts_Header, 26, 800, 0, "Calibri") This is all working like it should, but when i activate the GUI on another pc the text size is bigger and the GUI size is somewhat smaller. The problem is that it isn't on all computers, i can't seem to find the problem,.. If i make it fit on one pc it is to small on another or to big,.. What am i doing wrong? Is there some kind of attribute that i need to add to the top of my script to normalize text sizes in the script? Thanks! EDIT: Found the problem guys, some computers has changed the text size to 125% // Can i force 100% for my GUI somehow ? EDIT2: Fixed it guys! // I used the Function Below to get the DPI Setting and used that to determine the text size (example below) Func _GDIPlus_GraphicsGetDPIRatio($iDPIDef = 96) _GDIPlus_Startup() Local $hGfx = _GDIPlus_GraphicsCreateFromHWND(0) If @error Then Return SetError(1, @extended, 0) Local $aResult #forcedef $__g_hGDIPDll, $ghGDIPDll $aResult = DllCall($__g_hGDIPDll, "int", "GdipGetDpiX", "handle", $hGfx, "float*", 0) If @error Then Return SetError(2, @extended, 0) Local $iDPI = $aResult[2] Local $aresults[2] = [$iDPIDef / $iDPI, $iDPI / $iDPIDef] _GDIPlus_GraphicsDispose($hGfx) _GDIPlus_Shutdown() Return $aresults EndFunc ;==>_GDIPlus_GraphicsGetDPIRatio $Label_S2 = GUICtrlCreateLabel("Data from The Base", 10, 300, 400, 20) GUICtrlSetBkColor($Label_S2, $COLOR_WHITE) GUICtrlSetFont ($Label_S2, 13 * _GDIPlus_GraphicsGetDPIRatio()[0]) Edited December 28, 2016 by Blueman
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now