DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Adjustments to Code for Adjusted DPI Screens and for Centering of Grid Numbers  (Read 11,857 times)

SLC

  • Participant
  • Joined in 2014
  • *
  • Posts: 1
The grid was problematic for V1.19.72 when using adjusted DPI screen (e.g., Layout and scale of "150%"). The grid numbers were also off.  I made the adjustments in bold to the following portion of "creategroups:" code segment and it addressed the problems on my PC.


creategroups:
  gui,destroy
  setGuiColors()
  loop,%NGroups%
  {
    TriggerTop    := %A_Index%TriggerTop - ScreenTop
    TriggerBottom := %A_Index%TriggerBottom - ScreenTop
    TriggerLeft  := %A_Index%TriggerLeft - ScreenLeft
    TriggerRight  := %A_Index%TriggerRight - ScreenLeft

;adjustment for dpi of screen
TriggerTop /= A_ScreenDPI/96
TriggerBottom /= A_ScreenDPI/96
TriggerLeft /= A_ScreenDPI/96
TriggerRight /= A_ScreenDPI/96


    TriggerHeight := TriggerBottom - TriggerTop
    TriggerWidth  := TriggerRight - TriggerLeft
    GridTop      := %A_Index%GridTop
    GridLeft      := %A_Index%GridLeft
   

;Removed %A_Index% and now centering properly
    TextTop := TriggerTop - ScreenTop
    TextTop += Round(((TriggerBottom - TriggerTop) / 2 ) - 11)
    TextLeft := TriggerLeft - ScreenLeft
    TextLeft += Round(((TriggerRight - TriggerLeft) / 2) - 5)

Original address: https://www.donationcoder.com/forum/index.php?topic=52977.0