user1006221
user1006221

Reputation: 339

Calling drawtobitmap() on transparent controls

I have a transparent/opaque form that I was hoping to draw on to 'explain' what's going on in the program underneath said transparent form.

In order to evaluate what's going on, I need drawtobitmap to return what the control actually looks like on the screen with transparency but instead it simply captures a solid version of the form - essentially what it would look like if it didn't have an opacity value set.

Is there some OnPaint override trickery I can use to get around this or will I have to use graphics.copyfromscreen() with the relevant rectangle?

Upvotes: 0

Views: 474

Answers (1)

Matt Ko
Matt Ko

Reputation: 979

As suggested in the comments, DrawToBitmap() will only draw the window itself.
Transparency/opactiy cannot be seen in that context.

On the other side, Graphics.CopyFromScreen() will copy all pixels from the current graphics context, so this can make transparency/opactiy visible.

Upvotes: 1

Related Questions