topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday February 27, 2024, 2:02 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

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

SLC

  • Participant
  • Joined in 2014
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
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)