私はこのメソッドをPrint()
と呼びます。私はそれを呼び出すと、プライマリ画面のすべてのピクセルからビットマップを作成します。PrimaryScreenをAllScreensに正しく変更するにはどうすればよいですか?
ただし、プライマリ画面でのみ表示されます(はい、私はScreen.PrimaryScreen
で、Screen.AllScreens
ではありません)。
私はそれを試みましたが、私はすべての画面の配列を作成しなければなりませんでした。私はこの方法と全く同じことを、複数の画面ではどうすれば達成できますか?
private void Print()
{
string path;
path = "%AppData%\\Image.png";
path = Environment.ExpandEnvironmentVariables(path);
Bitmap bt;
Graphics screenShot;
bt = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
screenShot = Graphics.FromImage(bt);
screenShot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
bt.Save(path);
}
これは私が探していたものでした。それは簡単ではないことを知っていませんでした。 –