Jump to content

GDIplus & Windows Scale ui %


Go to solution Solved by kamesankamesan,

Recommended Posts

Posted

Hi,
My screen is a 2560x1440.
My windows ui scale is 125% 
I'm trying to draw a yellow rectangles on viewport area.
But my drawing area seems based on the 125% virtual resolution of 2048x1152
So rectangles are cropped.

here my code part:
 

Local $scale = _WinAPI_EnumDisplaySettings('', $ENUM_CURRENT_SETTINGS)[0] / @DesktopWidth
    _GDIPlus_Startup()
    Local $hDC = _WinAPI_GetDC($GE_Pos)
    Local $hPen = _GDIPlus_PenCreate(0xFFFFA500, 2) ; Format de couleur ARGB (Alpha, Rouge, Vert, Bleu)
    Local $rect = WinGetClientSize($GE_Pos)
    Local $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hDC)
   _GDIPlus_GraphicsDrawRect($hGraphics, ($Lpos[0]+$GE_Pos[0]+$Title_X_Tweak+2)*$scale, ($Lpos[1]+$GE_Pos[1]+$Title_Y_Tweak+2)*$scale, ($GE_Pos[2] - 4)*$scale, ($GE_Pos[3] - 4)*$scale, $hPen)    
   _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_PenDispose($hPen)
    _WinAPI_ReleaseDC($GE_Pos, $hDC)
    _GDIPlus_Shutdown()


i'm biting my head.
Any help is welcome.

Sans titre.png

Posted (edited)

Just pick the resolution you enjoy most at 100%. This is what I did.  And all your DPI and scaling issues will be resolved.  But if you insist on keeping your 125%, search for DPI awareness threads on this forum, there are numerous discussions of this topic.

Edited by Nine

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...