> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 在 PC 上支援高 DPI 顯示器

> 使用組件資訊清單在您的 PC 遊戲中啟用 Per-Monitor V2 DPI 感知，讓轉譯和滑鼠輸入在高 DPI 的 Windows 顯示器上正常運作。

為了協助 Windows 10 應用程式和殼層元素在不同像素密度的監視器上以一致的大小顯示，Windows 內建了縮放設定。若要讓您的遊戲在調整這些縮放設定後仍能正確轉譯並處理滑鼠輸入，請設定預設的 DPI 感知。若未這麼做，可能會導致您的遊戲顯示不正確，使擁有高 DPI 顯示器的玩家無法使用。

## 啟用高 DPI 感知

#### 確保您的遊戲支援高 DPI 顯示器

1. 檢查遊戲可執行檔的組件資訊清單 XML。這可能是 titleName.exe、titleName.exe 旁邊的資訊清單檔案，或遊戲可執行檔中的內嵌資訊清單。您可以使用 [sigcheck](https://learn.microsoft.com/sysinternals/downloads/sigcheck) 透過命令列從遊戲可執行檔擷取內嵌資訊清單 (如下所示)。
   ```cpp theme={null}
   sigcheck -m titleName.exe
   ```
2. 如果您在資訊清單 XML 中只看到下列 `<dpiAware>` 標籤，表示不支援高 DPI 顯示器。
   ```cpp theme={null}
   <windowsSettings>
       <dpiAware>
           true
       </dpiAware>
   </windowsSettings>
   ```
3. 內嵌資訊清單的優先順序高於鬆散資訊清單。如果存在內嵌資訊清單，請前往步驟 4。如果沒有內嵌資訊清單，請建立包含下列內容的 titleName.exe.manifest 檔案。
   ```cpp theme={null}
   <?xml version="1.0" encoding="UTF-8" standlone="yes"?>
   <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
   <application xmlns="urn:schemas-microsoft-com:asm.v3">
       <windowsSettings>
           <dpiAwareness xmlns="https://schemas.microsoft.com/SMT/2016/WindowsSettings">
               PerMonitorV2
           </dpiAwareness>
       </windowsSettings>
   </application>
   </assembly>
   ```
4. 如果有內嵌資訊清單，請使用 Windows SDK 中的下列 [Mt.exe](https://learn.microsoft.com/windows/win32/sbscs/mt-exe) 工具，透過命令列找出它。
   ```cpp theme={null}
   mt -inputresource:<titleExeFilename> -out:<manifestOutputFilename>
   ```
5. 編輯內嵌資訊清單以新增 `<dpiAwareness>` 標籤 (如下所示)。
   ```cpp theme={null}
   <windowsSettings>
       <dpiAwareness xmlns="https://schemas.microsoft.com/SMT/2016/WindowsSettings">
           PerMonitorV2
       </dpiAwareness>
   </windowsSettings>
   ```
6. 使用 Windows SDK 中的下列 [Mt.exe](https://learn.microsoft.com/windows/win32/sbscs/mt-exe) 工具，透過命令列更新內嵌資訊清單。
   ```cpp theme={null}
   mt -updateresource:<titleExeFilename> -manifest <manifestFilename>
   ```

您的遊戲現在支援高 DPI 顯示器了。

## 驗證高 DPI 感知

#### 確認您的遊戲支援高 DPI 顯示器

1. 使用配備高 DPI 顯示器的 PC (例如 Surface Studio 2)，前往 **\[設定]** > **\[顯示器]**，並將縮放比例設定為 **150%**。
2. 啟動您的遊戲。
3. 檢查有游標出現的畫面，並確認遊戲顯示如預期。例如，全螢幕遊戲應佔滿整個螢幕。
4. 在螢幕上移動游標，並確保游標可以到達遊戲視窗的整個表面區域。
5. 將游標停留在互動式 UI 元素 (例如按鈕) 上，並確認視覺狀態和互動如預期運作。例如，按鈕應在游標直接位於其上方時變更視覺狀態，而非在游標位於其旁邊時。

## 注意事項

* 停用登錄虛擬化可能會被建議作為高 DPI 感知問題的解決方案，但我們不建議這麼做。
* Visual Studio 在組態屬性中有 DPI 感知選項，但此選項使用較舊的 `<dpiAware>` 標籤，不適用於以 MSIXVC 封裝的遊戲。

## 另請參閱

[設定處理序的預設 DPI 感知](https://learn.microsoft.com/previous-versions/windows/desktop/legacy/mt846517\(v=vs.85\))


## Related topics

- [XAG 101：文字顯示](/zh-TW/build/game-principles/accessibility/xag-deep-dives/xag-101-text-display.md)
- [XUserPlatformRemoteConnectEventHandlers](/zh-TW/reference/system/xuser/structs/xuserplatformremoteconnecteventhandlers.md)
- [XGameUiShowMultiplayerActivityGameInviteUiCallback](/zh-TW/reference/system/xgameui/functions/xgameuishowmultiplayeractivitygameinviteuicallback.md)
- [XDisplayHdrModePreference](/zh-TW/reference/system/xdisplay/enums/xdisplayhdrmodepreference.md)
- [安裝 GDK 工具鏈](/zh-TW/home/setup-install/download-install.md)
