dpi

How to obtain the real screen resolution in a High DPI system?

与世无争的帅哥 提交于 2019-11-30 19:26:03
问题 So, Delphi programs are not DPI aware. This didn't bother me much until recently when I needed the real screen resolution (Wrong resolution reported by Screen.Width when "Make it easier to read what's on screen" is 150%) in a computer with High DPI. Some recommended was to make the application High DPI aware (XML manifest) but others are warning us that this involves a lot of work! So, being lazy (or lacking time), I wonder if there is a trick to compute the real resolution. One very dirty

Android 屏幕自适应问题

让人想犯罪 __ 提交于 2019-11-30 16:26:56
Android9 patch 图片 (.9.png 格式图片) 的特点和制作 一.9.png格式的文件的特点 与传统的png 格式图片相比, 9.png 格式图片在图片四周有一圈一个像素点组成的边沿,该边沿用于对图片的可扩展区和内容 显示区进行定义。这种格式的图片在android 环境下具有自适应调节大小的能力。(1)允许开发人员定义可扩展区域,当需要延伸图 片以填充比图片本身更大区域时,可扩展区的内容被延展。(2)允许开发人员定义内容显示区,用于显示文字或其他内容. 如下图所示: 左侧和上方的黑线交叉的部分即可扩展区域,右侧和下方的黑线交叉的部分即内容显示区. 二 .9.png 图片的制作 android sdk 的 tools文件夹下提供了制作该格式图片的工具 draw9patch.bat。使用此工具打开任意图片之后,将鼠标置于图片上。 被黑色覆盖的是不可编辑(锁住)的区域,周围的一圈一个像素的边沿是可编辑区域。按住鼠标左键,在左侧和上方的边沿画出可扩展区。 在右侧和下方画出内容显示区。完成绘制以后,选择file-> save ,即可保存为 .9.png 格式的文件,并在android项目中使用。 代码动态布局: [java] view plain copy //获取屏幕高宽 DisplayMetrics metric = new DisplayMetrics();

WPF ClickOnce DPI awareness Per-Monitor v2

只愿长相守 提交于 2019-11-30 16:10:18
I'm going to set up this question and answer it myself, so that others could search and find the correct answer easierly. I had to google for hours and compile the end result from multiple sources... So the question is - how to enable Per-Monitor v2 DPI awareness in a ClickOnce scenario (WPF, c# specifically)? Per-Monitor v2 was added in Win 10 Creators Update (1703). ClickOnce notoriously does not support DPI awareness declared in an app.manifest file, like this . First of all, anyone who want's to cry out - simply target .NET 4.6.2, per monitor DPI awareness is enabled by default - that is

WPF ClickOnce DPI awareness Per-Monitor v2

亡梦爱人 提交于 2019-11-30 16:10:06
问题 I'm going to set up this question and answer it myself, so that others could search and find the correct answer easierly. I had to google for hours and compile the end result from multiple sources... So the question is - how to enable Per-Monitor v2 DPI awareness in a ClickOnce scenario (WPF, c# specifically)? Per-Monitor v2 was added in Win 10 Creators Update (1703). ClickOnce notoriously does not support DPI awareness declared in an app.manifest file, like this. 回答1: First of all, anyone

Windows Display Setting at 150% still shows 96 DPI

我们两清 提交于 2019-11-30 13:01:17
On my laptop running Win7, when I set the display setting to 125%, the DPI shows up as 120 (using both graphics.DpiX and GetDeviceCaps) as expected. However, with the display at 150%, the DPI is 96 (?!), just like it is at 100%. Does anyone know a) why this is the case and b) is there any other way other than checking the DPI to detect if the display is set to anything other than 100%? I'm writing an app that I want to display a message when the display is set to >= 150%. Thanks. On Windows Vista and Windows 7, with DPIs above 120 (I think) and applications that it considers to be non-DPI

Can I Tell Visual Studio not to Change the DPI of a Project?

好久不见. 提交于 2019-11-30 09:37:10
I have a project converted from .NET 1.1 to 3.5 being developed in 2008. If I open the project on Windows 7, it converts the size of everything to 120dpi sizes. If I then open it with 96 dpi it changes back. Is there any way for me to develop so it looks good in both, and not have Visual Studio change the sizes if opened on a system with different DPI? This question is perhaps better phrased/duplicated here: visual studio designer dpi setting Or here: Visual Studio and DPI issue To be clear what I am trying to do is prevent the control from being resized in the designer when being used by

android 度量单位 dp sp px DPI

限于喜欢 提交于 2019-11-30 08:36:34
术语和概念 屏幕尺寸 Screen size 即显示屏幕的实际大小,按照屏幕的对角线进行测量, (比如 2.8寸, 3.5寸)。 为简单起见,Android把所有的屏幕大小分为四种尺寸:小,普通,大,超大(分别对应:small, normal, large, extra large). 应用程序可以为这四种尺寸分别提供不同的自定义屏幕布局-平台将根据屏幕实际尺寸选择对应布局进行渲染,这种选择对于程序侧是透明的。 系统会负责把你的布局方案以合适的方式渲染到对应的屏幕上,这个过程是不需要程序员用代码来干预的。 屏幕长宽比 Aspect ratio 长宽比是屏幕的物理宽度与物理高度的比例关系。应用程序可以通过使用限定的资源来为指定的长宽比提供屏幕布局资源。 只需要用系统提供的资源分类符long和 notlong。 分辨率 Resolution 在屏幕上显示的物理像素总和。例如 320*480。需要注意的是:尽管分辨率通常用宽x高表示,但分辨率并不意味着具体的屏幕长宽比。 在Andorid系统中,应用程序不直接使用分辨率。 密度 Density 在单位屏幕面积上能显示的像素数量。 在同样的宽高区域,低密度的显示屏能显示的像素较少,而高密度的显示屏则能显示更多的像素。 屏幕密度非常重要,因为其它条件不变的情况下,一个宽高固定(这里宽高应是指的像素)的UI组件(比如一个按钮

How to get the dpi of an image(Java)

帅比萌擦擦* 提交于 2019-11-30 05:44:54
问题 In c#, we can use Image.HorizontalResolution and Image.VerticalResolution. But in java, how to get it? I found ImageInfo.java , but it only support a few image types. http://kickjava.com/src/imageinfo/ImageInfo.java.htm 回答1: You can use Apache Commons Sanselan library to get image info: http://commons.apache.org/imaging/index.html. final ImageInfo imageInfo = Sanselan.getImageInfo(file_); final int physicalWidthDpi = imageInfo.getPhysicalWidthDpi(); final int physicalHeightDpi = imageInfo

How do dp, dip, dpi, ppi, pixels and inches relate?

一曲冷凌霜 提交于 2019-11-30 03:00:57
I was reading dp, dip, px, sp measurements , but I still have some questions about dp/dpi vs ppi vs px vs inch. I am not able to compare them... is an inch the largest? They say 160 dpi means 160 pixels per one inch. Does that mean 1 inch contains 160 pixels? They also say 1 pixel on a 160 dpi screen = 1 dp. Does that mean 1 pixel and 1 dp are equal? And lastly, why should we use dp instead of px? I understand that it is ideal, but why ? You should (almost) always use flexible sizing units, like dp , which is Density-Independent Pixels, because 300px on one device is not necessarily the same

How do you scale the title bar on a DPI aware win application?

不想你离开。 提交于 2019-11-30 02:23:30
I am making my app dpi-aware per monitor by setting <dpiAware>True/PM</dpiAware> in the manifest file. I can verify with process explorer that this is indeed working or by calling GetProcessDpiAwareness. This is all working fine and I can scale anything in the client area fine in my code. However, my only problem is that if I drag my app from a system-dpi monitor to a non-system dpi monitor, the title bar and any system menu would either become too big or too small. This isn't the case for most built-in apps (e.g. calc, edge browser, etc..) so there must be away to scale it properly. Does