C# GUI Design for Mac Retina Displays - c#

I'm using Avalonia UI to create an application that is available for both Windows as well as macOS, and have come across the issue that, when using a macOS device that has a Retina display, the entire application is scaled up quite massively, estimated about two times. This means that my application, which, in its smallest form is about the size of the Windows Explorer default, actually falls outside of the screen on these Retina displays, which, of course, is not ideal.
Is there a solution?

Related

WPF application "bitmap-scaled" on Remote Desktop with Hi DPI

My WPF application works well on Hi-DPI display (e.g. My Yoga Pro 2 laptop, with 192 DPI display (13 inch, 3200x1800).
All vector-defined GUI elements are crisp and sharp - without any explicit programming for that. Seems then WPF can pick the proper rendering DPI matching DPI of the display and automatically all is fine. As far as the program is running locally.
However, when the same application is run on remote desktop, (connection to local Virtual machine with "enhanced" desktop mode) - the application is rendered # 96 DPI, and scaled-up twice to have proper size. The problem is that this scaling is bitmap-scaling which naturally produces blurry/pixelated appearance.
I believe that this should be plain-easy to declare something to make the app rendered "natively" with the High DPI on the RDP, without the need to scale it afterwards (by the system anyway) to make it expected size.
I tried to set in app.manifest
true
but, it did not solve the problem...
Any ideas ?
Btw - other applications (e.g. Windows Explorer can render on RDP at proper DPI, without later being scaled up to match natural size (note: on high DPI everything looks small if not rendered natively with high dpi).
I've isolated the problem to a blank WPF application with a mere TextBlock to display. This app, when run on RDP (Windows 10 Creators version or later) can easily be used to reproduce the problem (The text is proper size, but is bitmap-scaled (as part of the whole application scaled up)).
Thanks,
Michael

WPF application window not scaled on second monitor

My WPF application window is not scaled on the second monitor, running Windows 10.1607. The built-in monitor runs at 200% (high DPI) and the external monitor at 100% scaling. Most other program windows change their size and internal scaling when they are moved between monitors, but mine does not. It appears huge on the external monitor, and has double the icon and text size compared to correct scaling.
The application targets .NET Framework 4.0 and the app.manifest file contains the relevant entries for Windows 10 support and dpiAwareness. Even if I remove these entries, it doesn't change. I don't know whether this has worked before, I couldn't find an old version that does.
What do I need to do to let Windows scale my window on a different-DPI monitor just as any other window? I don't currently expect it to be sharp (.NET 4.6.2 has news to that), blurry rescaling is okay. But it just needs to do anything and not render the window at 200% on a 100% monitor.
Seems to be a Windows/Surface bug. Every time I resume the Surface Pro 4 (all updates installed) from standby, a number of applications are not rescaled when moved to another monitor. After a logoff and logon, it works normally again.

Screenshot capture from monitors with different resolutions in WPF

I want to take a screenshot of the user's currently active window (and run OCR on top of it at a later stage). This (e.g. described here) works fine as long as the developer works on standard monitors with the same resolution.
The problem is, that WPF uses device-independent units and the native API functions require pixels. I found many resources how to fix this for my own WPF application, most prominantly here and here. However, I found no way to do this dependent on what monitor the window is currently shown. For example, if the developer has a laptop with a QHD dipslay and uses a secondary monitor with a normal HD resolution. I found a C++ solution on MSDN, but not in C#.
Does anyone have experience with this or any suggestions?
Thanks.

How to determine whether a program uses DirectX, and if so, what's the DirectX surface size?

I'm using Spazzarama's Direct3DHook to capture screenshots from an application (with the purpose of streaming them over the Internet). Although this works well when the application uses DirectX, it fails if the application does not use DirectX (e.g. Notepad).
How can I determine whether a running application (process) uses DirectX? The reason is that in that case, I would need to use a different way to capture a screen, e.g. using GDI+.
When this DirectX application is not running in full screen mode, how do I get the size of the DirectX surface? E.g. when I capture the screen of a game running in windowed mode, the application size includes the size of the window frame etc. too, and my captured screen is typically too large.

Displaced controls in windows forms .net framework

I have a strange problem. I have designed a windows form application in c# and .net framework 3.5. In the runtime, the form and its controls are fine in all the computers except my laptop, where the controls are not in the correct positions.
If I design the form from scratch on my laptop with correct positioning it will result in an invalid shape for other computers.
My efforts:
If I run the windows in Safe Mode the form size and control positions
are correct.
I have uninstalled the Video Driver and used default windows version but the problem still persists.
I used different frameworks like 2.0 and 4.0, and different Visual Studios versions and they all have the same problems.
Actually all the .net framework product from all the companies indicate the same issue.
My computer Settings:
Laptop 1557 Studio DELL
Graphic ATI Radeon HD 4500
When the text size is artificially increased to 125% text and controls that are rather closely placed will wrap around the form and push everything down/over. If this is something you intend to support, you'll simply have to redesign your form to handle the different enlargement levels you care to support and test those enlarged text modes in your app until you're satisfied with their appearance. It's not something you can strictly control, since increased text size is an accessibility feature.
I assume it is due to a screen resolution differences. I believe that the actual location of the controls is identical in both cases, in one the screen is "larger" and therefor your controls appear in a different position on the screen.
try Designing forms to work on different resolutions and aspect ratios on Windows CE
Another thing you can (and should) do is work with WPF, which is the new way to build user interfaces for windows.
I've found a workaround just now.
In the display settings of Windows 7 I have changed the Text size from 125% to 100%. Everything is smaller but in accurate positions and sizes.
Still wondering how it works!!

Categories