WinVista/7 Changed dpi Tips

Share your advanced PureBasic knowledge/code with the community.
User avatar
oryaaaaa
Addict
Addict
Posts: 825
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

WinVista/7 Changed dpi Tips

Post by oryaaaaa »

I checked Win7 JP 32bit. for gadget, menu and 2D drawing.

Code: Select all

Procedure.i Gui_GetDesktopDpiX() 
  Protected hdc.i
  Protected hDpi.i 
  hdc = GetDC_(GetDesktopWindow_())
  If hdc
    hDpi = GetDeviceCaps_(hdc, #LOGPIXELSX)
    ReleaseDC_(GetDesktopWindow_(), hdc)
  EndIf
  ProcedureReturn hDpi
EndProcedure

Global ScreenDpi.f
ScreenDpi = 96/Gui_GetDesktopDpiX()

FontID1 = LoadFont(1, "FONT", Round(18*ScreenDpi, #PB_Round_Nearest))
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: WinVista/7 Changed dpi Tips

Post by IdeasVacuum »

Great tip!
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
oryaaaaa
Addict
Addict
Posts: 825
Joined: Mon Jan 12, 2004 11:40 pm
Location: Okazaki, JAPAN

Re: WinVista/7 Changed dpi Tips

Post by oryaaaaa »

150% Menu Font Problems. I want to fix by PB.
Post Reply