display program correct with 96dpi and 120dpi

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

I have display problems when a user has the 120dpi display font selected.

Listboxes and text in buttons are not displayed correctly.

Is there an easy way to make my program work with 96 dpi and 120dpi display fonts.



Using Windows 98 SE
Registered Purebasic
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
http://www.chordplanet.com
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

I would check the GetTextExtentPoint32_() API, I use it a lot to achieve what you say. Previously, use:

Code: Select all

hDC = GetDC_(WindowID())
hFont = GetStockObject_(#DEFAULT_GUI_FONT)
OldObject = SelectObject_(hDC, hFont)
GetTextExtentPoint32_(hDC, "My text", 7, sz.SIZE)
; now you have text width and height in pixels in
; sz\cx and sz\cy
; Use those values to set the initial
; size of your gadgets (give some air around, say 4 px).
SelectObject_(hDC, OldObject)
ReleaseDC_(WindowID(), hDC)
BTW, I use 120 dpi fonts in my computer

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Fangbeast.

Thanks El_Choni, I've had someone whinging about the size of my projects, he uses 120 DPI and I didn't know what I should do about it either:)

We are Dyslexic of Borg, prepare to have your ass laminated!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by cor.

Thanks El_Choni



Using Windows 98 SE
Registered Purebasic
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
http://www.chordplanet.com
Post Reply