点击透明表格 [英] Click through transparent form

查看:26
本文介绍了点击透明表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个半透明的全屏表单,我需要可以通过这个表单控制我的电脑.

I have a semi transparent fullscreen form and I need can control my computer over this form.

实际上我们需要在电脑上使用红屏滤镜来观察天空,但我们不想使用红色有机玻璃之类的东西.

Actualy we need red screen filter on computer for observing the sky, but we don't want to use something like red plexiglass.

我尝试了 Windows API(监控配置功能)http://msdn.microsoft.com/en-us/library/windows/desktop/dd692964(v=vs.85).aspx但我做不到.我做了像红色过滤器这样的透明形式(一切看起来都是红色和黑色的色调),但我无法通过我的形式控制计算机.有人帮我吗?

I tried Windows API's (Monitor Configuration Functions) http://msdn.microsoft.com/en-us/library/windows/desktop/dd692964(v=vs.85).aspx but I can't do it. I did transparent form like red filter (everything seems Red and Black tones), but I can't control computer over my form. Anybody help me about that ?

推荐答案

创建一个新的 VCL 项目.在主窗体的属性中,设置ColorclRedAlphaBlendtrueAlphaBlendValue127WindowStatewsMaximizedFormStylefsStayOnTop,以及添加以下代码:

Create a new VCL project. In the properties of the main form, set Color to clRed, AlphaBlend to true, AlphaBlendValue to 127, WindowState to wsMaximized, FormStyle to fsStayOnTop, and add the following code:

type
  TForm1 = class(TForm)
  private
  protected
    procedure CreateParams(var Params: TCreateParams); override;

...

procedure TForm1.CreateParams(var Params: TCreateParams);
begin
  inherited;
  Params.ExStyle := Params.ExStyle or WS_EX_LAYERED or WS_EX_TRANSPARENT;
end;

(示例视频, 示例编译的 EXE)

这篇关于点击透明表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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