2023-10-01から1ヶ月間の記事一覧

【WPF】特定のウィンドウプロセスの座標を取得する

WPF

まず、クラス内に定義している変数や構造体、WindousAPIからusingして使っている関数達の定義を載せておきます。 //ウィンドウ名からウィンドウハンドルを取得(WindowsAPIの関数) [DllImport("user32.dll")] public static extern IntPtr FindWindow(string …

【WPF】Bitmap、Graphics間の転送の書き方、ややこしい

WPF

//widthHeight=ウィンドウの縦横の長さ Bitmap screenshot = new Bitmap(width, height); using (Graphics graphics = Graphics.FromImage(screenshot)) { graphics.CopyFromScreen(windowRect.Left, windowRect.Top, 0, 0, new System.Drawing.Size(width, …