开发者

How do I scrape what a transparent panel shows into a bitmap?

开发者 https://www.devze.com 2023-01-14 00:31 出处:网络
Question: How do I scrape what a transparent panel shows into a bitmap? Background: I need to make a form that sits on top of everything and blurs part of the screen but doesn\'t stop the user fro

Question:

How do I scrape what a transparent panel shows into a bitmap?

Background:

I need to make a form that sits on top of everything and blurs part of the screen but doesn't stop the user from interacting with it. Odd... I know.

I created a form and added a panel to it. I then set the set background color of the pan开发者_StackOverflow中文版el to red. Then set the form's TransparentKey property to red and topmost = True.

So now I have a transparent panel. Cool. I can interact with the app below it. Cool. Now I just need to add the blur. I would like to take what is showing on panel1 and blur it then display on panel2 that sits over the top of panel1. Or at least that is the idea.

Important detail:

DrawToBitmap() just shows the red background.

This is running on XP.


Yes, DrawToBitmap(). But not on the transparent panel, on the one that's underneath it. If that 'panel' isn't actually yours then you have to use Graphics.CopyFromScreen().

Not sure what you intend to do with it, but drawing the blurred image in the transparent panel will make it non-transparent and you cannot interact with the underlying window anymore. Also, don't use Red, you'll get unintended transparency if the underlying window contains any red. Color.Fuchsia is a good choice, it is a fuchsed-up color.

0

精彩评论

暂无评论...
验证码 换一张
取 消