dpi

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

China☆狼群 提交于 2019-11-26 10:27:30
问题 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 displaying the very original DPI-->96 ). I can do nothing but changing the screen resolution, which could absolutely make everything blurry on LCD. Yes, I have a laptop with a high DPI monitor, 15.6\' with 1920x1080 resolution, some Java desktop

WPF 中的设备无关单位

放肆的年华 提交于 2019-11-26 09:05:16
WPF窗体以及内部的所有元素都是采用设备无关的单位来衡量的。一个设备无关单位定义为1英寸的96分之一,即1/96 inch。 假定我们创建了一个WPF按钮,其大小为96x96个单位,如果使用标准Windows的DPI设置(96dpi),那么每个单位对应的大小为一个真实世界的物理像素。计算公式如下: 物理单位大小 = 设备无关单位大小x系统DPI = 1/96 inch x 96 dpi = 1 pixel 对于一个20英寸的显示器,其标准分辨率为1600x1200,那么它的屏幕DPI为: (1600^2+1200^2)^0.5/20=100 在这样的显示器上,一个96x96单位的按钮就会比1英寸要小。同理,15英寸的LCD显示器的DPI大约是85,那上面提到的按钮就要比1英寸大一些。 现在假如我们将系统的DPI设置为120dpi,那么WPF的渲染引擎就的一个设备无关单位就等于1.25个像素(1/96 inch x 120dpi),一个96x96单位的按钮实际大小就为120x120个像素。 这里就出现了所谓的“分数”像素,一个绘图点可能会落在显示器的两个像素点之间,这时WPF就会引入抗锯齿机制(antialias)。 转载于:https://www.cnblogs.com/SpadeQ/archive/2008/06/23/1228433.html 来源: https://blog

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

社会主义新天地 提交于 2019-11-26 06:12:50
问题 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 getResources().getDimension(R.dimen.tutorial_cross_marginTop); This works but the value I get is multiplied times the screen density factor (1.5 for hdpi, 2.0 for xhdpi, etc). I also tried to do getResources().getString(R.dimen.tutorial_cross_marginTop); This would work in principle but I

Detecting the system DPI/PPI from JS/CSS?

情到浓时终转凉″ 提交于 2019-11-26 04:51:25
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 other devices. I'm wondering if there's a way to detect this automatically. My initial research seems to say no. The only suggestion I've seen is to make an element whose width is specified as "1in" in CSS, then check its offsetWidth (see also How to access screen display’s DPI settings via javascript? ). Makes sense, but iPhone is lying to me with that

How can I set the dpiAware property in a Windows application manifest to “per monitor” in Visual Studio?

限于喜欢 提交于 2019-11-26 04:49:24
问题 I need to be able to set the dpiAware property in the manifest of my application to \"per monitor\". The available choices in the properties are just to enable or disable DPI awareness. Neither of these settings works for me. I can get the behavior I want for my application if I don\'t embed the manifest in the exe, then edit the manifest manually. I want to automatically generate and embed the manifest. Is there something I am missing? (I am using Visual Studio 2013.) 回答1: New in Windows 10

How do I convert ppi into dpi for Android images?

痴心易碎 提交于 2019-11-26 04:09:34
问题 I have started making graphics for my Android app using Adobe Photoshop. But I am unable to proceed, as the resolution in Photoshop is set in pixels per inch where as the official Google documentation says Android will require images set in dpi. I have searched the web for the conversion between the two but never ended up with any proper formula. I know that the Android documentation describes the relation as px = dp*dpi/160 . But my problem is that if I know dpi where do I get the value of

How to control the font DPI in .NET WinForms app

和自甴很熟 提交于 2019-11-26 03:49:45
问题 I created an app for a small business. Some of the employees in the office can not see the form correctly. The reason is they have their DPI setting set to above 96dpi. Does anybody know of a way to control this? For all of you who have experience with winforms apps, how do you control your form layout so that DPI does not affect the look of the application? 回答1: Assuming you do not try to honor the user's UI font choice (SystemFonts.IconTitleFont), and hard-code your forms for one font size

Detecting the system DPI/PPI from JS/CSS?

微笑、不失礼 提交于 2019-11-26 01:53:48
问题 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 other devices. I\'m wondering if there\'s a way to detect this automatically. My initial research seems to say no. The only suggestion I\'ve seen is to make an element whose width is specified as \"1in\" in CSS, then check its offsetWidth (see also

How to get Windows Display settings?

做~自己de王妃 提交于 2019-11-26 01:44:30
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 on the setting value. Is that possible? This setting is the screen DPI, or dots per inch. Read it like so: float dpiX, dpiY; Graphics graphics = this.CreateGraphics(); dpiX = graphics.DpiX; dpiY = graphics.DpiY; I don't think it's possible at the moment for the X and Y values to be different. A value of 96 corresponds to 100% font scaling (smaller)

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

旧巷老猫 提交于 2019-11-26 01:36:50
问题 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 .NET 2.0. At least based on our research and testing so far. However, if some of you out there know better, we\'d love to hear from you. (Please don\'t bother arguing we should switch to WPF... that\'s not an option right now.) Questions: What in