dpi

Getting DPI of PDPage/PDDocument to calculate PDF Dimensions Accurately

╄→гoц情女王★ 提交于 2019-12-13 04:28:24
问题 I'm looking to get an accurate size of each page in a PDF as part of a Unit test of PDF's I'll be creating. As I'm dealing with PDFs that have many different page sizes in each document the code returns an ArrayList of dimensions. AFAIK each page can have its own DPI setting too. I've done quite a bit of Googling but I've only come up with this which only gives me part of the answer, as I still need to work out what DPI each page is. PDFBox - find page dimensions public static ArrayList<float

Converting pixels to dpi for mdpi and hdpi screens

时间秒杀一切 提交于 2019-12-13 04:17:18
问题 I am using this code that I have found on another thread which is working fine on mdpi screens: public static float convertDpToPixel(float dp,Context context){ Resources resources = context.getResources(); DisplayMetrics metrics = resources.getDisplayMetrics(); float px = dp * (metrics.densityDpi/160f); return px; } public static float convertPixelsToDp(float px,Context context){ Resources resources = context.getResources(); DisplayMetrics metrics = resources.getDisplayMetrics(); float dp =

Resizing main menu for high DPI/font size

徘徊边缘 提交于 2019-12-13 00:34:48
问题 I have an issue with font height in standard main menu/popup menu when it contains images. Looks like this. When there are no images, there are no problems as displayed above. Main menu uses TImageList with image width/height set to 16. So I want to preserve image size at 16x16 and center it, to get something like this: How can I read the font height of the main menu and adjust images in TImageList accordingly? One idea I have is to copy images from one TImageList to another with larger image

About monitor physical size, screen resolution, dpi

孤人 提交于 2019-12-13 00:29:22
问题 I have a dell laptop latitude 5420. The built-in monitor has a width of 12.20 inches and a height of 6.69 6,86 inches. OS is Windows7. The screen resolution is set to 1600 by 900 (prefered resolution). Additionally Windows7 is configured with a "Set custom text size (DPI)" of 100% (9 point Segoe UI at 96 pixels per inch). I think this means windows7 thinks 1 inch of my monitor uses 96 pixels. If I divide 1600 pixels by 12.20 inches (or 900 by 6,86) it results around 131,1. What should be the

Real size WPF controls for printing

混江龙づ霸主 提交于 2019-12-12 17:15:36
问题 I am currently developing an application where users can create/move TextBlocks on a canvas dynamically. Once they have positioned the TextBlocks where they want them they can press a print button which will cause a ZPL printer to print what is currently displayed on screen. The ZPL commands are built by taking the following values from each TextBlock: XPosition = Canvas.Left YPosition = Canvas.Right Text = Text However I can't find a way of getting the printout to resemble the on screen

How to create a scaling and size-changing Per-Monitor DPI-aware application that is backwards compatible with Windows 7?

谁都会走 提交于 2019-12-12 10:41:08
问题 I'm new to WPF (and to DPI-awareness APIs) and am writing an application for running in Windows 7, 8.1, and 10. I use multiple monitors with different per-monitor DPI settings, and am interested in making my application as compatible as possible across desktop configurations. I already know that is possible to add a Manifest to a WPF application, uncomment the section for DPI awareness, and set it to True/PM . This successfully allows the program to be Per-Monitor DPI-aware in Windows 8.1 and

Determine if an open WPF window is visible on any monitor

霸气de小男生 提交于 2019-12-12 08:38:58
问题 Is there a way to determine if an open WPF window is currently visible in any of the desktop's connected monitors? By visible I mean that the window's bounds rectangle intersects with the desktop rectangle of any of the monitors. I need this functionality to determine if a window needs to be repositioned because the monitor configuration (working areas bounds, monitor count) changed between restarts of my application (which saves window positions). I have come up with the code below and it

Problems getting WinForms to scale correctly with DPI

僤鯓⒐⒋嵵緔 提交于 2019-12-12 08:33:35
问题 I'm running into problems with getting a WinForms app to display correctly at high DPI settings. I've checked various web sites, and the WinForms all have the correct AutoScaleMode. I've tried setting this to both DPI and Font. However, the forms always get cut off near the bottom when using high DPI settings (e.g. 125%). I added some code to check, and if I set AutoScaleMode to DPI, when the form loads, I see that AutoScaleDimensions is 120,120 when the form loads, and

How to use a different coordinate system in WPF? (scaling only)

流过昼夜 提交于 2019-12-12 07:55:07
问题 (Let me give you some context) I am currently designing an application that is supposed to generate a printable A4 page based on some data. Naturally, the device independent pixels of WPF (96 pixels/inch) are not a very natural unit of measurement in the paper world. Something like millimetres would be more appropriate. So I got my calculator out and arrived at a scaling factor of something around 3.779. It turns out that simply slapping everything that's supposed to go on the page in a

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

点点圈 提交于 2019-12-12 07:13:44
问题 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