C#Alpha Blend透明图片框 [英] C# Alpha Blend Transparent PictureBox

查看:64
本文介绍了C#Alpha Blend透明图片框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表单上显示了一个网络摄像头供稿,并希望在其顶部进行绘制.我本打算使用图片框来执行此操作,但我发现PictureBox不支持真正的透明度,而仅支持其所使用表单的颜色.它还不支持alphablending,这是我希望其显示的方式,类似于可以使表格显示的方式.

I have a webcam feed being displayed on my form and would like to draw on top of it. I was going to do this using a picture box, I have found the PictureBox doesn't support true transparency instead just the colour of the form it's on. It also doesn't support alphablending which is how I would want it to display, similar to how forms can be made to appear.

有人知道该怎么做吗?还是实施了可以做到这一点的控件?

Does anyone know how to do this? Or have a control implemented that can do this?

推荐答案

在大多数情况下,OwenP使用鲍勃·鲍威尔(Bob Powell)在

In most circumstances OwenP's answer of doing this using the method Bob Powell demonstrated in transcontrols will work. However, because it was a direct draw interface to the webcam ,the live feed always seemed to be on top of the other controls.

为解决此问题,我作了一点点欺骗,并创建了一个辅助表单,该表单打开了视频供稿-无边框,设置为始终位于最前面,并具有透明性-我直接画在此表单上.然后,我只需要以这种辅助形式处理一些事件,以专注于原始形式并在使用另一个程序时进行处理.

To solve this I cheated a little and created a secondary form that opens over the video feed - this had no borders, was set to always on top, and given transparency - I drew directly onto this form. I then just had to handle a few events in this secondary form to keep focus on the original form and handle when another program is in use.

这篇关于C#Alpha Blend透明图片框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆