CJ7
CJ7

Reputation: 23275

How to take screenshot of Form from within app?

What code would effectively take a screenshot of a Form and put a copy of this image on to the clipboard?

So I would like something like: Form.CopyScreenshotToClipboard

Upvotes: 2

Views: 2471

Answers (2)

TCS
TCS

Reputation: 5900

Just a thought, what about simulating ALT+PRNSCN when your form is the focused form?

This will make a screenshot of the form and put it in the clipboard.

Upvotes: 0

MarkJ
MarkJ

Reputation: 30408

  1. Create a hidden PictureBox at design time
  2. Use Deanna's answer to get the form drawn into a PictureBox. Use form.hWnd to get the hWnd
  3. Then copy the picturebox contents onto the clipboard like this

Upvotes: 1

Related Questions