Quantcast
Channel: C#タグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 9360

Windows Forms で PerMonitorV2 設定して動きを見てみた

$
0
0

試したこと

  • Windows Forms アプリを新規作成して app.manifest を追加
  • supportedOS タグの Windows 10 のコメントアウトを外す
<compatibilityxmlns="urn:schemas-microsoft-com:compatibility.v1"><application><!-- Windows 10 --><supportedOSId="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/></application></compatibility>
  • App.config で PerMoniterV2 の設定を追加
<?xml version="1.0" encoding="utf-8" ?><configuration><startup><supportedRuntimeversion="v4.0"sku=".NETFramework,Version=v4.7.2"/></startup><System.Windows.Forms.ApplicationConfigurationSection><addkey="DpiAwareness"value="PerMonitorV2"/></System.Windows.Forms.ApplicationConfigurationSection></configuration>
  • Form のフォントを Yu Gothic UI, 9pt に変更
  • Form の AutoScaleMode を Font から Dpi に変更
  • ListBox や DataGridView なんかを置いた画面を適当に作成
  • デバッガーにアタッチしない状態で実行して動きを確認

結果

ListBox のある画面

拡大率 100% の画面

image.png

150% に持って行った状態

image.png

100% に再度移動させた状態

image.png

なんか 100% → 150% → 100% に持っていったら ListBox のフォントが大きくなった…

DataGridView

100% で表示

image.png

150% に移動

image.png

100% に再度移動

image.png

DataGridView の中のチェックボックスの大きさがちょっとうまく行ってないなぁ。

まとめというか感想

このうまくいかない部分にきちんと対応しようと思ったらどうするのが正攻法なんだろう??
今回はとりあえず動きを見てみたので、次やるとしたら対処法の調査かな…

参考


Viewing all articles
Browse latest Browse all 9360

Latest Images

Trending Articles