日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

为托管应用程序添加DPI Aware支持

發(fā)布時間:2025/3/15 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 为托管应用程序添加DPI Aware支持 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

今天下午講的一節(jié)Webcast中重點介紹了High DPI,關(guān)于這個內(nèi)容由于虛機中不支持DPI Aware的原因,沒有做成Demo,現(xiàn)在給大家一個教程,希望對大家在的程序支持Windows 7系統(tǒng)有所幫助:

1. 創(chuàng)建一個托管應(yīng)用程序(VB.NET或C#皆可,我這里用C#做一個例子):

2. 右擊選擇項目并添加一個app.manifest文件:

3. 使用下面的代碼覆蓋該文件:

<?xml?version="1.0"?encoding="utf-8"?>?
<asmv1:assembly?manifestVersion="1.0"?xmlns="urn:schemas-microsoft-com:asm.v1"?xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"?xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"?xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance%22>?
??<assemblyIdentity?version="
1.0.0.0"?name="MyApplication.app"/>?
??
<asmv3:application?xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">?
????
<asmv3:windowsSettings?xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings%22>?
??????<dpiAware>true</dpiAware>?
????</asmv3:windowsSettings>?
??</asmv3:application>?
??<trustInfo?xmlns="
urn:schemas-microsoft-com:asm.v2">?
????
<security>?
??????
<requestedPrivileges?xmlns="urn:schemas-microsoft-com:asm.v3">?
????????
<!--?UAC?Manifest?Options?
????????????If?you?want?to?change?the?Windows?User?Account?Control?level?replace?the?
????????????requestedExecutionLevel?node?with?one?of?the?following.?

????????<requestedExecutionLevel??level="asInvoker"?uiAccess="false"?/>?
????????<requestedExecutionLevel??level="requireAdministrator"?uiAccess="false"?/>?
????????<requestedExecutionLevel??level="highestAvailable"?uiAccess="false"?/>?

????????????If?you?want?to?utilize?File?and?Registry?Virtualization?for?backward?
????????????compatibility?then?delete?the?requestedExecutionLevel?node.?
????????
-->?
????????
<requestedExecutionLevel?level="asInvoker"?uiAccess="false"?/>?
??????
</requestedPrivileges>?
????
</security>?
??
</trustInfo>?
</asmv1:assembly>

?

4. 在Form1窗體上添加一些ToolBox的按鈕:

5. 再創(chuàng)建一個項目:

6. 不要添加Manifest,直接在Form1上添加幾個Toolbox的按鈕:

7. 將解決方案編譯好:

8. 在桌面屬性選擇Display:

9. 選擇DPI為150%:

10. 登出系統(tǒng)再登錄就可以應(yīng)用該設(shè)置:

?

11. 打開剛才編譯好的兩個應(yīng)用程序就可以看到不同了:

兩個程序哪個是DPI Aware的呢,大家可以猜猜,好,本文就到此,感謝!

轉(zhuǎn)載于:https://www.cnblogs.com/WilsonWu/archive/2009/04/29/1446479.html

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎

總結(jié)

以上是生活随笔為你收集整理的为托管应用程序添加DPI Aware支持的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。