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

  • Home
  • SEARCH
  • 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 5850179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T13:06:17+00:00 2026-05-22T13:06:17+00:00

How do Dpi Points relate to Pixels for any display my application is running

  • 0

How do Dpi Points relate to Pixels for any display my application is running on?

int points;
Screen primary;

public Form1() {
  InitializeComponent();
  points = -1;
  primary = null;
}

void OnPaint(object sender, PaintEventArgs e) {
  if (points < 0) {
    points = (int)(e.Graphics.DpiX / 72.0F); // There are 72 points per inch
  }
  if (primary == null) {
    primary = Screen.PrimaryScreen;
    Console.WriteLine(primary.WorkingArea.Height);
    Console.WriteLine(primary.WorkingArea.Width);
    Console.WriteLine(primary.BitsPerPixel);
  }
}

Do I now have all of the information I need?

Can I use any of the information above to find out just how long 1200 pixels is?

  • 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. Editorial Team
    Editorial Team
    2026-05-22T13:06:18+00:00Added an answer on May 22, 2026 at 1:06 pm

    I realize it has been a few months, but while reading a book on WPF, I came across the answer:

    If using standard Windows DPI setting (96 dpi), each device-independent unit corresponds to one real, physical pixel.

    [Physical Unit Size] = [Device-Independent Unit Size] x [System DPI]
                         = 1/96 inch x 96 dpi
                         = 1 pixel
    

    Hence, 96 pixels to make an inch through the Windows system DPI settings.

    However, this does, in reality, depend on your display size.

    For a 19-inch LDC monitor set to a resolution of 1600 x 1200, use the Pythagoras theorem helps to calculate pixel density for the monitor:

    [Screen DPI] = Math.Sqrt(Math.Pow(1600, 2) + Math.Pow(1200, 2)) / 19
    

    Using this data, I wrote up a little static tool that I now keep in my Tools class of all my projects:

    /// <summary>
    /// Calculates the Screen Dots Per Inch of a Display Monitor
    /// </summary>
    /// <param name="monitorSize">Size, in inches</param>
    /// <param name="resolutionWidth">width resolution, in pixels</param>
    /// <param name="resolutionHeight">height resolution, in pixels</param>
    /// <returns>double presision value indicating the Screen Dots Per Inch</returns>
    public static double ScreenDPI(int monitorSize, int resolutionWidth, int resolutionHeight) {
      //int resolutionWidth = 1600;
      //int resolutionHeight = 1200;
      //int monitorSize = 19;
      if (0 < monitorSize) {
        double screenDpi = Math.Sqrt(Math.Pow(resolutionWidth, 2) + Math.Pow(resolutionHeight, 2)) / monitorSize;
        return screenDpi;
      }
      return 0;
    }
    

    I hope others get some use out of this nifty little tool.

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

Sidebar

Related Questions

When obtaining the DPI for the screen under Windows (by using ::GetDeviceCaps) will the
I am working on silverlight application and finding the DPI of Canvas. so how
I have around 1000 pdf filesand I need to convert them to 300 dpi
I have a JPEG picture with a DPI of 72. I want to change
After enabling our aplication to use AutoScaleMode = DPI we are getting a strange
In the past I had seen occasions where images that weren't 72 dpi wouldn't
I am a flex developer, and most of the time I am dealing with
I am trying to do something similar to this but in Android. In Android
we have a Silverlight 4 app that prints a multi-page report. When the number
They appear to assume that web designers assume a fixed 72DPI (or something specific

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.