添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Tagged:

Viewing 6 reply threads

Hi Andrew, we are facing a big issue in Windows 7 and 8 here (does not happen in Windows 10) and we would like some insight of the correct way to fix them. When we set the Scaling to 125%, everything become bigger, except the window itself.

What we tried with no success:
* Using the app.manifest from here: https://github.com/c-smile/sciter-sdk/blob/master/demos/usciter/win-res/dpi-aware.manifest
* Calling the SetProcessDPIAware function.

All our CSS is in em, px, dpi and %. We found a way to fix it by using vw, vh and sizing in % instead. The problem is that we noticed this issue a bit late and we have around 400 html pages to modify.

So we would like to know if there is another general way to fix this beside the app.manifest or calling the SetProcessDPIAware function, which are not working for us.

Attached are screenshots at Scaling 100% and 125%

Thank you very much, your help is really appreciated

Try to use this manifest in your application as it is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
  <asmv3:application>
    <asmv3:windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
      <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>

From: https://docs.microsoft.com/en-us/windows/win32/hidpi/setting-the-default-dpi-awareness-for-a-process

Do you see problems with wsciter/usciter.exe from SDK on these machines?
If not then problem is in manifest and the way how you apply/link it in your resources.

by using vw, vh and sizing in % instead

That is ABSOLUTELY not an option as it has nothing with ppi.

Thanks for the fast answer.

I tried that manifest, still not working as expected.

To define the sizes of those windows, we are using the method CreateWindow() from SciterSharp, which we pass the RECT frame in it and use DefaultCreateFlags

public const SciterXDef.SCITER_CREATE_WINDOW_FLAGS DefaultCreateFlags = SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_MAIN | SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_TITLEBAR | SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_RESIZEABLE | SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_CONTROLS | SciterXDef.SCITER_CREATE_WINDOW_FLAGS.SW_ENABLE_DEBUG; public void CreateWindow(PInvokeUtils.RECT frame = new PInvokeUtils.RECT(), SciterXDef.SCITER_CREATE_WINDOW_FLAGS creationFlags = DefaultCreateFlags, IntPtr parent = new IntPtr()) _hwnd = _api.SciterCreateWindow( creationFlags, ref frame, _proc, IntPtr.Zero, parent

Does this answer your question?

I’ll try usciter.exe on Monday (since I left work already)

I will take a guess and say you are using .Net Framework (SciterSharp)?

1. What version of .Net Framework are you using?
3. What version of SciterSharp are you using?
2. What version of Sciter (TIS) binaries ( sciter.dll )?

Typically the manifest is added in the .csproj file (you never specified how you added the manifest, just making sure).

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        //...
        <ApplicationManifest>app.manifest</ApplicationManifest>
        //...
    </PropertyGroup>
</Project>

As for SetProcessDPIAware , this must be called before any Windows are created (basically when your app starts), also you shouldn’t have to mix 'n match it with the manifest file.

For what it’s worth SetProcessDPIAware on Windows Vista (and newer), superseded by SetProcessDpiAwareness on Windows 8.1 (and newer), superseded by SetProcessDpiAwarenessContext on Windows 10 1607 (and newer).

From pinvoke.net

[DllImport("user32.dll", SetLastError=true)]
static extern bool SetProcessDPIAware();

On Windows 7, changing the scaling requires the user to log out and back in (I’m sure you know this, as you will get a prompt) to get it working correctly.

Hello @wdcossey and thanks a lot for your help

To answer your questions:
1. .Net Framework 3.5
2. Latest SciterSharp from source with minimal changes to make it work with .Net Framework 3.5
3. sciter.dll version 4.4.5.8 (the latest we bought)

Regarding manifest, it is in an ItemGroup

<ItemGroup> <None Include="app.manifest" /> </ItemGroup>

You might have pointed something here. So maybe the app.manifest wasn’t taken in consideration. I’ll try to fix this an let you know

Thank you very much

@wdcossey Just tried to add it correctly through VS2019

  <PropertyGroup>
    <ApplicationManifest>app.manifest</ApplicationManifest>
  </PropertyGroup>

But I still have the same issue.

This is my full app.manifest at the moment

<?xml version="1.0" encoding="utf-8"?> <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> <requestedExecutionLevel level="asInvoker" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> <!-- Windows Vista --> <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" /> <!-- Windows 7 --> <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" /> <!-- Windows 8 --> <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" /> <!-- Windows 8.1 --> <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" /> <!-- Windows 10 --> <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> </application> </compatibility> <application xmlns="urn:schemas-microsoft-com:asm.v3"> <windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware> <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness> </windowsSettings> </application> </assembly>

About SetProcessDPIAware, Yes it was set at the start of the application, before anything else was done.

Also I want to mention that this issue does not occur in Windows 10… it only occurs in Windows 7 and Windows 8.1

My issue is when the Scale 125% is set before we launch our application. I didn’t try during the application is running because as you said, we need to log off first.

Hope this helps

SciterCreateWindow() accepts rectangle in screen (a.k.a. physical) pixels. These values are not scaled by any means.

In order window to have proper (scaled) dimensions you should define either something like this:

window-width="800dip" window-height="600dip"> </html>

or to use view.move(x,y,w,h) in initial script of that window:

var physical_width = self.toPixels(800dip);
var physical_height = self.toPixels(600dip);
view.move(0,0,physical_width,physical_height);

or to use logical pixels to screen conversion on .NET side. Google: “.NET Framework convert dips to pixels”

To add new topic:

Select forum from the below and type your message in "Create New Topic " text box.

Forums

To login

Note to login to the forum you shall use your user name, but not e-mail address.

QQ.COM and 163.COM email users:

please use other email addresses for registration. Seems like these mail servers reject emails from sciter’s domain.

Recent Topics