简体   繁体   中英

WinForm DPI issue

There was this issue:

WinForm looks different than in VS designer

I thought I solved with this one:

https://stackoverflow.com/a/13228495/1806838

I used the app.manifest one.

<dpiAware>true</dpiAware>

After that all seemed to be OK. It looks perfect if I debug or if I run the application from the folder where I build it. ( app\\app\\bin\\Release\\app.exe ). But if I copy the executable outside that folder (for eg to my Desktop, and I run it then it looks like this (the right one obviously): 在此处输入图片说明

It's like the app.manifest is not embedded, but I checked the settings and it seems to be OK. Also, I made sure that in the app properties the correct manifest file is being selected.

Any ideas?

EDIT: So, it seems if the app.exe.manifest is in the same folder then it looks good, otherwise it's not.

EDIT2: I found that I have 2 app.mainfest files. One is app\\app\\app.manifest and the other one is app\\app\\Properties\\app.manifest . So I deleted both and added a very new one having the DPI setting in it. I still have the same issue. Checked the app.manifest properties and the Build Action is set to None . Shall I change it?

EDIT3: I addedd app.manifest to the Resources and set app -> Properties -> Manifest to be Resources\\app.manifest . Still the same.

So, after trying to compile the app.manifest for 3 days, I added another setting to see whether it's going to be applied. This was the run as admin:

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />

And when I tried to build with that I got an error message stating that it's not compatible with ClickOnce . And this was the point when I realized what a moron I am. After disabling ClickOnce via app -> Properties -> Security -> uncheck Enable ClickOnce security settings everything is just working perfectly. It seems that if it's enabled then it ignores the manifest.

I'm really sorry for the time of people tried to help wasted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM