Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

delphi - Click through transparent form

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.

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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;

(Sample video, Sample compiled EXE, Source)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...