c# Winforms Controls 将它们所在的组件渲染为 bmp(智能屏幕截图?)
问题:
我有一个 UserControl (LightBox),它覆盖了许多其他控件,以允许用户看到它所在的控件,但不允许用户与 Lightbox 下的控件进行交互。 Winforms(据我发现几乎是臭名昭著)不擅长处理 alpha 混合。
问题:
如何让 Lightbox 控件呈现其创建时所在位置的 BMP(快照)?
说明:
我希望这样做的原因是允许灯箱从这个渲染的快照中绘制自己的背景。 这将(希望)阻止我遇到的大量闪烁和不良渲染影响的问题。
这还有可能吗?!
感谢您的帮助。
编辑1: 这个问题似乎解释了我遇到的一些问题面对并至少描述了我正在尝试做的事情,即创建背景图像的缓冲区。 但是,没有链接解释如何实现这一点
The problem:
I have a UserControl (LightBox) which overlays a number of other controls to allow the user to see the controls it is positioned over, but not allow the users to interact with the controls under the Lightbox. Winforms is (almost notoriously as I'm finding out) bad at handling alpha-blending.
Question:
How can I get the Lighbox control to render a bmp (snapshot) of whatever it is positioned over when it is created?
Explanation:
The reason I am looking to do this is to allow the Lightbox to draw its own background from this rendered snapshot. This would (hopefully) stop the issues that I am experiencing with large quantities of flicker and undesirable rendering affects.
Is this even possible?!
Thanks for your help.
EDIT 1:
This question seems to expain some of the issues that I am facing and at least describes what I am attempting to do i.e. create a buffer of the background image. However, there are no links explaining how this might ab achieved
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 Control.DrawToBitmap 将控件绘制到位图的函数:
You can use the Control.DrawToBitmap function to draw the control to a Bitmap: