LoginSignup
2
0

More than 5 years have passed since last update.

visualstudioで作ったc#アプリからのスクリーンショットがずれた時の対処

Last updated at Posted at 2018-08-15

c#で有るタイミングでスクショをとって暗号化して保存するやつを作っていたときにはまった部分。
app.manifestを書きかえることでHighDPIに対応する
visualstudioの
プロジェクト>新しい項目の追加>アプリケーションマニフェストファイル
を選択し追加。

  <!-- アプリケーションが DPI 対応であり、それ以上の DPI で Windows によって自動的にスケーリングされないことを
       示します。Windows Presentation Foundation (WPF) アプリケーションは自動的に DPI に対応し、オプトインする必要は
       ありません。さらに、この設定にオプトインする .NET Framework 4.6 を対象とする Windows Forms アプリケーションは、
       app.config ファイルで 'EnableWindowsFormsHighDpiAutoResizing' 設定を 'true' に設定する必要があります。-->
  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
    </windowsSettings>
  </application>

この部分のコードのところのコメントを外す。
あとは心おきなくCopyFromScreen等をやる。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0