screen-resolution

Android Convert Px to Dp (Video Aspect Ratio) [duplicate]

这一生的挚爱 提交于 2019-11-27 06:49:55
Possible Duplicate: converting pixels to dp in android I'm trying to convert pixels to dp. What is the formula? Lets convert 640 and 480 into dp. The docs say this The conversion of dp units to screen pixels is simple: px = dp * (dpi / 160) But I don't think that is what I need (and I don't know how to use this). I guess I just need the forumla. I have the code ready: DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); switch(metrics.densityDpi) { case DisplayMetrics.DENSITY_LOW: int sixForty = ? int fourEighty = ? break; case

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 detect in jquery if screen resolution changes?

白昼怎懂夜的黑 提交于 2019-11-27 04:17:44
问题 How can I make it so that each time when user changes the screen resolution size [not the browser window], the page perform a function? 回答1: Ok, so you're using jQuery. So let's make a custom event for it. (function () { var width = screen.width, height = screen.height; setInterval(function () { if (screen.width !== width || screen.height !== height) { width = screen.width; height = screen.height; $(window).trigger('resolutionchange'); } }, 50); }()); Now $(window).bind('resolutionchange', fn

Difference between “screen size” and “screen density” in Android?

喜夏-厌秋 提交于 2019-11-27 04:15:49
问题 I have a few questions: What is the screen size ? What is the screen density ? What is a difference between screen size and screen density ? How I can support different densities and different screen sizes in Android? I have already read the official documentation, but I was unable to understand the difference between screen size and screen density . 回答1: Screen density means how many pixels appear within a constant area of the display, dots per inch = dpi Screen size means amount of physical

How to auto resize and adjust Form controls with change in resolution

半腔热情 提交于 2019-11-27 02:58:19
I have noticed that some applications change their controls position to adjust them as much as possible in the resolution as possible, If window is maximized they set themselves in such a way that over all GUI looks balanced. My question is that is it possible to make or implement this functionality in Visual studio 2010 C#? SwDevMan81 Use Dock and Anchor properties. Here is a good article. Note that these will handle changes when maximizing/minimizing. That is a little different that if the screen resolution changes, but it will be along the same idea. Use combinations of these to get the

Understanding Samsung Galaxy Tab screen density

≯℡__Kan透↙ 提交于 2019-11-27 02:22:37
问题 One would say that if the Galaxy Tab screen resolution (in portrait mode) is 600px and the screen width is 3.55inch , the screen density would be 600/3.55 = 169 dpi . Knowing that and keeping in mind the way the device independent pixels (dp) is computed (http://developer.android.com/guide/practices/screens_support.html): px = dp * (dpi / 160); 600 = dp * (169 / 160); dip = 568 So drawing a horizontal line of 568dp (device independent pixels) width starting at position 0 must exactly match

Resize display resolution using python with cross platform support

痴心易碎 提交于 2019-11-27 02:14:25
问题 Resize display resolution using a python function. It should be cross platform, ie support for windows, linux and mac (it is okay to have multiple cases depending on the operating system) I have code which I think works on linux (Ubuntu) I am looking for a solution for windows and mac (should support both 32 and 64 bit machines) def SetResolution(width, height): os.popen("xrandr -s "+str(width)+'x'+str(height)) I would also appreciate it if somebody could tell me how I could get the possible

Android: Showing wrong screen resolution

笑着哭i 提交于 2019-11-27 02:05:39
I was trying to get the screen resolution of android phones,using this code DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); str_ScreenSize = dm.widthPixels + " x " + dm.heightPixels; str_ScreenSize = "dd" + " x " + dm.heightPixels; When i tried this code in my Galaxy S phone i got the screen resolution as 320x533 px, but in reality the Galaxy S got a screen resolution of 480x800 px. So what's wrong with the code?? How can i get the actual screen resolution of a particular device?? Finally after 2 days of searching and testing, i finally managed

How do I convert Twips to Pixels in .NET?

眉间皱痕 提交于 2019-11-27 02:05:38
问题 I'm working on a migration project in which a database actually stores display sizes in twips. Since I can't use twips to assign sizes to WPF or Winforms controls, I was wondering if .NET has a conversion method usable at runtime? 回答1: It turns out that the migration tool has something, but it wouldn't do any good at runtime. Here's what I did (if the hard-coded value in the extension method were changed to the value for points per inch it would work as a point converter too): 1 Twip = 1