PrintScreen only active window

后端 未结 6 2056
太阳男子
太阳男子 2021-01-07 08:22

I\'m writing a simple Windows Forms utility to screenshot either the entire screen or an active window and save the file. The winform has a button called \'Capture\' that, w

6条回答
  •  别那么骄傲
    2021-01-07 09:01

    What about SendKeys?

    Windows.Forms.SendKeys.Send("%{PRTSC}");
    

    It will copy currently selected window in to Clipboard object.

    Than calling

    BitmapSource image = Clipboard.GetImage();
    

    you can get your image back

提交回复
热议问题