Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 151467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:27:15+00:00 2026-05-11T09:27:15+00:00

I’m trying to figure out the font DPI size on the target Windows machine

  • 0

I’m trying to figure out the font DPI size on the target Windows machine and modify our app’s font so that it appears the same size as it would if the target machine had the same dpi as the dev machine. (So a larger Target DPI would mean we’d make our fonts smaller than at dev time).

I’m wondering if there are any problems with the solution below and specifically whether LOGPIXELSX=88 is correct.

Background

I resize all controls and fonts on our forms to match the current Windows screen resolution. However, if someone has their Font DPI set higher, we need to account for that and make the font smaller (so it ends up being the right size on the screen). Our fonts are already quite large (especially since we resize them w/ screen res). The extra size from the higher DPI makes the text too large.

My solution so far From what I can tell, if we use the GetDeviceCaps as below and then get the CurrentFontDPI and do this: (Ignoring the font size modification due to the new screen resolution):

NewFontSize=CurrentFontSize * (DevelopmentDPI/CurrentFontDPI)

 Function CurrentFontDPI   Dim hwnd, hDC, logPix, r As Long   Dim  LOGPIXELSX=88   hwnd = GetDesktopWindow()   hDC = GetDC(hwnd)   logPix = GetDeviceCaps(hDC,LOGPIXELSX )   r = ReleaseDC(hwnd, hDC)   CurrentFontDPI= logPix 

end Function

FYI, the above code is part of a larger routine at ‘a related SO Question][1]. I left out the rest of the code b/c it seemed to at least one error (it had NewFont=OldFont * (NewDPI-OldDPI) which would give you zero height fontsize if the DPI hadn’t changed)

[1]: http://www.BungalowSoftware.com test

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:27:16+00:00Added an answer on May 11, 2026 at 9:27 am

    Here’s a good article from Microsoft on writing DPI-aware applications. (Note that this article is different than the one posted to your related question.)

    LOGPIXELSX is a parameter for a Windows system call; it is not a DPI value.

    In VB6 (IIRC) you can use the ratio of TwipsPerPixel (X and Y) at development time to TwipsPerPixel (X and Y) at runtime as another way to determining how to scale. Same as your DPI ratio but it takes advantage of built-in VB properties.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I know there's a lot of other questions out there that deal with this
I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.