Questions tagged [dpi]

DPI stands for Dots Per Inch

Dots per inch (DPI, or dpi) is a measure of spatial printing or video dot density, in particular the number of individual dots that can be placed in a line within the span of 1 inch (2.54 cm).

1209 questions
950
votes
35 answers

Converting pixels to dp

I have created my application with the height and width given in pixels for a Pantech device whose resolution is 480x800. I need to convert height and width for a G1 device. I thought converting it into dp will solve the problem and provide the same…
Indhu
  • 9,806
  • 3
  • 18
  • 17
559
votes
21 answers

getting the screen density programmatically in android?

How to get the screen density programmatically in android? I mean: How to find the screen dpi of the current device?
Praveen
  • 90,477
  • 74
  • 177
  • 219
422
votes
10 answers

Load dimension value from res/values/dimension.xml from source code

I'd like to load the value as it is. I have two dimension.xml files, one in /res/values/dimension.xml and the other one in /res/values-sw360dp/dimension.xml. From source code I'd like to do something like…
Héctor Júdez Sapena
  • 5,329
  • 3
  • 23
  • 31
169
votes
8 answers

How to write WinForms code that auto-scales to system font and dpi settings?

Intro: There's a lot of comments out there that say "WinForms doesn't auto-scale to DPI/font settings well; switch to WPF." However, I think that is based on .NET 1.1; it appears they actually did a pretty good job of implementing auto-scaling in…
Brian Kennedy
  • 3,499
  • 3
  • 21
  • 27
117
votes
7 answers

How to configure an app to run correctly on a machine with a high DPI setting (e.g. 150%)?

I've created a simple Winforms application in C#. When I run the application on a machine with high DPI settings (e.g. 150%), the application gets scaled up. So far so good! But instead of rendering the fonts with a higher font size, all texts are…
Boris
  • 8,551
  • 25
  • 67
  • 120
89
votes
4 answers

What's the correct size icon for drawable-xxhdpi?

As we know, the correct sized icon: * drawable-ldpi (120 dpi, Low density screen) - 36px x 36px * drawable-mdpi (160 dpi, Medium density screen) - 48px x 48px * drawable-hdpi (240 dpi, High density screen) - 72px x 72px * drawable-xhdpi (320 dpi,…
Jerikc XIONG
  • 3,517
  • 5
  • 42
  • 71
87
votes
11 answers

How to get Windows Display settings?

There is setting for Display in Windows 7 (Control Panel -> Display). It allows to change the size of the text and other items on the screen. I need to get this setting to be able to switch on/switch off some functionality in my C# application based…
newmember
  • 873
  • 1
  • 7
  • 5
81
votes
10 answers

Creating a DPI-Aware Application

I have a form application in C#. When I change the monitor's DPI, all the controls move. I used the code this.AutoScaleMode = AutoScaleMode.Dpi, but it didn't avoid the problem. Does anyone have an idea?
RRR
  • 3,937
  • 13
  • 51
  • 75
79
votes
7 answers

How to set the DPI of Java Swing apps on Windows/Linux?

If you have an monitor with a DPI over 150 (such as Macbook Pro), you may also find the problem: the font on the Java Swing app is too small for high DPI monitor, and I cannot change the font size at all ( It ignores the Windows DPI directly, only…
Searene
  • 25,920
  • 39
  • 129
  • 186
78
votes
11 answers

How can I get the DPI in WPF?

How can I get the DPI in WPF?
tom greene
  • 5,361
  • 9
  • 39
  • 52
63
votes
15 answers

Detecting the system DPI/PPI from JS/CSS?

I'm working on a kind of unique app which needs to generate images at specific resolutions according to the device they are displayed on. So the output is different on a regular Windows browser (96ppi), iPhone (163ppi), Android G1 (180ppi), and…
Josh Santangelo
58
votes
4 answers

How to access screen display’s DPI settings via javascript?

Is there a way to access the screen display's DPI settings in a Javascript function? I am trying to position a HTML panel on the page and when the user's DPI is set to large (120), it throws the position off. I need to be able to know what the DPI…
Yttrium
  • 2,057
  • 7
  • 25
  • 28
53
votes
2 answers

Set the size of ggsave exactly

R question. I got so confused by the width, height, dpi and unit. Why the following two size different? ggsave(filename = "foo.png",ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point(size=2, shape=23),width = 5, height = 4, dpi = 300, units = "in",…
WCMC
  • 1,602
  • 3
  • 20
  • 32
45
votes
6 answers

Changing DPI scaling size of display make Qt application's font size get rendered bigger

I have created some GUI application using Qt. My GUI application contains controls like push button and radio button. When I run the application, buttons and fonts inside button looks normal. When I change the DPI scaling size of display from 100%…
Arun
  • 2,247
  • 3
  • 28
  • 51
44
votes
2 answers

Scaling the non-client area (title bar, menu bar) for per-monitor high-DPI support

Windows 8.1 introduced the ability to have different DPI settings for different monitors. This feature is known as "per-monitor high-DPI support." It persists and has been further refined in Windows 10. If an application does not opt in (i.e., is…
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
1
2 3
80 81