dpi

GetSystemMetrics() returns wrong value for SM_CXSCREEN

落花浮王杯 提交于 2019-11-27 06:46:32
问题 I've run into an interesting problem. At least in Vista, getSystemMetrics(SM_CXSCREEN) returns an incorrect value when the desktop DPI settings aren't set at 100%. For example, I tried 150% in a 1366x768 screen and getSystemMetrics() returns 911 instead of 1366 (and 1366 / 1.5 ~ 911) According to the MSDN, getSystemMetrics(SM_CXSCREEN) returns pixels, so I thought this value wouldn't be affected by the DPI settings - but it is. So is there a safer way to find out the true, unscaled screen

How can I change Windows 10 Display Scaling Programmatically using C#

感情迁移 提交于 2019-11-27 06:09:51
问题 I'm trying to find a way to change the Display Scaling in Windows 10 Programmatically using C#. Let me also say that, I'm not trying to create a application that automatically forces the users screen to change resolution/scaling. Its just a tool for me to beable to toggle scales from the tray, as its something I often have to do for testing. So purposely designed for this action. So, I was able to track down what registry entries ( HKEY_CURRENT_USER\Control Panel\Desktop ) are set when a User

How to get DPI in C# .NET?

两盒软妹~` 提交于 2019-11-27 04:43:01
问题 I'm trying to build a Windows Forms application using C#. How do I get the DPI in .NET? I've read before that there is DPIX and DPIY, which can be used in .NET to get the current DPI. Is that correct? Thanks all. 回答1: Use an instance of the Graphics class. You get this using the following within your form (could be in form's Load event handler): float dx, dy; Graphics g = this.CreateGraphics(); try { dx = g.DpiX; dy = g.DpiY; } finally { g.Dispose(); } 来源: https://stackoverflow.com/questions

Comet OJ - Contest #8C 符文能量___dp

梦想与她 提交于 2019-11-27 01:32:03
题目大意: 分析: 发现最后的答案就是 b 1 ∗ a 2 + b 2 ∗ a 3 + … … + b n − 1 ∗ a n b_1*a_2+b_2*a_3+……+b_{n-1}*a_n b 1 ​ ∗ a 2 ​ + b 2 ​ ∗ a 3 ​ + … … + b n − 1 ​ ∗ a n ​ 然后对于其中的一些连续的项需要乘上 k k k 或者 k 2 k^2 k 2 如果 a i ∗ k a_i*k a i ​ ∗ k ,那么 b i b_i b i ​ 也要 ∗ k *k ∗ k 第 i i i 项是 b i ∗ a i + 1 b_i*a_{i+1} b i ​ ∗ a i + 1 ​ , 设 d p i , 0 , 0 dp_{i,0,0} d p i , 0 , 0 ​ 表示前i项中,当前项中 b i , a i + 1 b_i,a_{i+1} b i ​ , a i + 1 ​ 都没有进行 ∗ k *k ∗ k 操作,前面也没有进行 ∗ k *k ∗ k 操作时的最小合并代价 设 d p i , 0 , 1 dp_{i,0,1} d p i , 0 , 1 ​ 表示前i项中,当前项中 b i , a i + 1 b_i,a_{i+1} b i ​ , a i + 1 ​ 都没有进行 ∗ k *k ∗ k 操作,前面进行了 ∗ k *k ∗ k

Android xxx-hdpi real devices

筅森魡賤 提交于 2019-11-27 01:31:40
问题 I'm gonna release my app, it's a 1.2Mb apk that includes about 120 icons in 4 different formats (ldpi, mdpi, hdpi, x-hdpi). If I add xx-dpi and xxx-hdpi icons the apk grows bigger and loading time increases. There are many entry-level devices out there with really loooow memory and I'd like my app to run everywhere. Do I really need to add xx-hdpi? And is there a real device that requires xxx-hdpi? 回答1: You shouldn't really need xxxhdpi . It was only introduced because of the way that

Stop Firefox DPI Scaling (when Windows setting is at 125%)

拥有回忆 提交于 2019-11-27 01:15:02
问题 I'm currently making a webpage and testing it in chrome works fine, but in Firefox - it is zoomed in. This is because my DPI in Windows is set to 125%, and Firefox detects this, and adjusts every webpage accordingly. However, my webpage is not meant to be viewed at such a zoom level, the images aren't made to be displayed that big, and hence it looked blurred/pixelated. The general layout of the page is messed up too, because everything is so big. Now, this doesn't affect most people - as

Pixel to Centimeter?

非 Y 不嫁゛ 提交于 2019-11-27 00:53:28
I just want to know if the pixel unit is something that doesn't change, and if we can convert from pixels to let's say centimeters ? Mark Ransom Similar to this question which asks about points instead of centimeters. There are 72 points per inch and there are 2.54 centimeters per inch, so just substitute 2.54 for 72 in the answer to that question. I'll quote and correct my answer here: There are 2.54 centimeters per inch; if it is sufficient to assume 96 pixels per inch, the formula is rather simple: centimeters = pixels * 2.54 / 96 There is a way to get the configured pixels per inch of your

C# Scaling UserControl content to match users Dpi/Font Size

半腔热情 提交于 2019-11-26 20:42:46
问题 How do I get my OwnerDrawn UserControl to respect the users dpi (96/120/xxx) and/or font-size (normal, large, extra large)? Some people suggest to use the DpiX and DpiY properties on a Graphics object, but that doesn't seem to to anything in my control (i.e. they are always set to 96, regardless of which font-size or dpi I choose). There is another similar question here on StackOverflow where it suggests to use the AutoScale properties, but the suggested solutions don't really do anything

WPF: How to specify units in Dialog Units?

浪子不回头ぞ 提交于 2019-11-26 20:09:39
问题 i'm trying to figure out how to layout a simple dialog in WPF using the proper dialog units (DLUs). What's a dialog unit? A dialog is a unit of measure based on the user's preferred font size. A dialog unit is defined such that the average character is 4 dialog units wide by 8 dialog units high: This means that dialog units: change with selected font changed with selected DPI setting are not square i spent about two hours dimensioning this sample dialog box from Windows Vista with the various

How to change resolution (DPI) of an image?

和自甴很熟 提交于 2019-11-26 19:59:07
问题 I have a JPEG picture with a DPI of 72. I want to change 72 dpi to 300 dpi. How could I change resolution of JPEG pictures using C#? 回答1: This article talks about modifying the EXIF data without the re-saving/re-compressing (and thus loss of information -- it actually uses a "trick"; there may be more direct libraries) required by the SetResolution approach. This was found on a quick google search, but I wanted to point out that all you need to do is modify the stored EXIF data. Also: .NET