dpi

How to find real display density (DPI) from Java code?

帅比萌擦擦* 提交于 2019-11-29 16:17:14
I'm going to do some low-level rendering stuff, but I need to know real display DPI for making everything of correct size. I've found one way to do this: java.awt.Toolkit.getDefaultToolkit().getScreenResolution() — but it returns incorrect result on OS X with "retina" display, it's 1/2 of the real DPI. (In my case it should be 220, but it's 110) So either some other, more correct API must be available, or alternatively I need to implement a hack just for OS X — somehow find if the current display is "retina". But I couldn't find any way to query for this information too. There's this answer

DPI Scaling in .Net 3.5 in Mixed WinForms and WPF Application

不打扰是莪最后的温柔 提交于 2019-11-29 13:58:54
In this post , CodeNaked discusses how to change the TextFormattingModeProperty of the application. This solves my problem (see below) perfectly in .Net 4. However my production application is in .Net 3.5 which doesn't have that property at all. How do I accomplish the same thing in .Net 3.5? My root problem: I have a winforms application based in .Net 3.5 that has some WPF controls on certain screens. When the Windows DPI setting is set to 150% (not 120%), scaling occurs as expected. However, as soon as a WPF control is created, the scaling is set back to 100% for all windows. I would like

How can I make Windows 8.1 aware that my Delphi application wants to support Per Monitor DPI?

巧了我就是萌 提交于 2019-11-29 11:03:48
问题 I have tried to make Windows 8.1 recognize a Delphi XE6 application (a demo program) that I have been trying to build, and have it recognize my application is Per-Monitor DPI aware, purely by the Manifest technique. Delphi XE6 (and all other similarly up to date versions of Delphi) make adding a manifest easy to do, inside Project Options, and I have done so. This is the .manifest content I have determined using MSDN resources. I suspect it could be slightly incorrect. If you want to try this

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

感情迁移 提交于 2019-11-29 10:43:57
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 does this manually via the official dialog seen below: However, obviously working with the registry

WinForms Different DPI Layouts

谁都会走 提交于 2019-11-29 07:47:50
Somehow forms and controls created through Visual Studio and the designer have the great ability to scale themselves depending on the current DPI/font size of Windows. One portion of my UI is a tab control full of dynamic pages and labels/inputs generated depending on the user's selection. When these are created, they use hard coded sizes that look right for 96 DPI. Is there an automated way in .Net to take these generated controls and do the same resizing that is performed for the designer generated controls? I'd like to avoid scaling the controls myself as this is older code not easily

how can i change the dpi of an image with the imagick extension

我怕爱的太早我们不能终老 提交于 2019-11-29 07:29:16
I need to change all uploaded files to 72 dpi. I'm using the php imagick extension. heres what i've tried (the image i'm using is 300dpi): $image = new Imagick(); $image->setResolution(72,72) ; $image->readImage($img); $image->resampleImage (72,72,imagick::FILTER_UNDEFINED,1); $image->writeImage($target) this doesn't seem to anything. the image is uploading, but stays at 300dpi MatTheCat's answer is spot on. You might also try setImageUnits() to ensure it's working with inches and not centimeters. $image->setImageUnits(imagick::RESOLUTION_PIXELSPERINCH); $image->setImageResolution(72,72);

Screen Resolution not matching Screen.Bounds

时间秒杀一切 提交于 2019-11-29 04:03:24
I am seeing an interesting difference between the resolution that is set through Control Panel and the output of Screen.Bounds for my widescreen laptop. The screen is 15.5" and the resolution set through Control Panel is 1920x1080. However when I run some code like this. Screen[] screens = Screen.AllScreens; foreach (Screen scr in screens) { Console.WriteLine("Width: " + scr.Bounds.Width + ", Height: " + scr.Bounds.Width); } The output shows my resolution being 1536x864. I have done some looking around, and I thought it may be related to a DPI issue, and when I look at my display settings, the

How to calculate the correct image size in out pdf using itextsharp?

混江龙づ霸主 提交于 2019-11-29 03:52:58
I' am trying to add an image to a pdf using itextsharp, regardless of the image size it always appears to be mapped to a different greater size inside the pdf ? The image I add is 624x500 pixel (DPI:72): alt text http://www.freeimagehosting.net/uploads/727711dc70.png And here is a screen of the output pdf: alt text http://www.freeimagehosting.net/uploads/313d49044d.png And here is how I created the document: Document document = new Document(); System.IO.MemoryStream stream = new MemoryStream(); PdfWriter writer = PdfWriter.GetInstance(document, stream); document.Open(); System.Drawing.Image

C# WPF resolution independancy?

这一生的挚爱 提交于 2019-11-29 03:45:56
I am developing a map control in WPF with C#. I am using a canvas control e.g. 400 x 200 which is assigned a map area of e.g. 2,000m x 1,000m. The scale of the map would be: canvas_size_in_meters / real_size_in_meters . I want to find the canvas_size_in_meters. The canvas.ActualWidth gives the Width in DIU's (Device Independant Units). So, 400 DIU's is 400/96 = 4,17 inches, PROVIDED that the physical resolution of my monitor is 96 dpi. However, using a ruler, I found that the physical resolution of my monitor is 87 dpi. (There are only few monitors that ACTUALLY have 96 physical dpi) That DPI

Supporting DPI and Default Font Changes

泄露秘密 提交于 2019-11-29 01:05:01
So I'm trying to figure out how the Form's AutoScaleMode property can possibly help to support a system with a font or DPI that is different from my work development machine. From the SDK: AutoScaleMode Enumeration public enum AutoScaleMode None Automatic scaling is disabled. Font Controls scale relative to the dimensions of the font the classes are using, which is typically the system font. Dpi Controls scale relative to the display resolution. Common resolutions are 96 and 120 DPI. By default .NET 2.0 Forms use AutoScaleMode.Font. So I designed a sample form on my Windows XP, Tahoma 8 pt, 96