TVideoGrabber.SetWindowTransparency

Prev

Next

TVideoGrabber

Methods

 




































































































Sets the transparency (color key or alpha value) on a window or form


Declaration
function SetWindowTransparency (WndHandle: HWND; UseColorKey: Boolean; ColorKeyValue: TColor; UseAlpha: Boolean; AlphaValue: LongInt): Boolean;


bool __fastcall SetWindowTransparency (HWND WndHandle, bool UseColorKey, COLORREF ColorKeyValue, bool UseAlpha, byte AlphaVAlue)


function SetWindowTransparency (WndHandle as Long, UseColorKey as Boolean, ColorKeyValue as Long, UseAlpha as Boolean, AlphaValue as Long) as Boolean

Description

Used to set the transparency (color key or alpha value) on a window or form.

Set ColorKeyEnabled = true, then invoke this function and pass the handle to the form you wish to be transparent.

You can find sample code in the transparency checkbox code of the "display" tab of the MainDemo project.

E.g. in Delphi:

procedure TfrmMainForm.chkTransparencyClick(Sender: TObject);
begin
   // in this sample the transparent window is created in the VideoGrabberColorKeyChange
   // event below when the color key is set
   VideoGrabber.ColorKeyEnabled := chkTransparency.Checked;
   if VideoGrabber.ColorKeyEnabled then begin
      if not assigned (FTransparentForm) then begin
         Application.CreateForm (TForm, FTransparentForm);
         FTransparentForm.Width := 300;
         FTransparentForm.Height := 100;
         FTransparentForm.Position := poScreenCenter;
         FTransparentForm.FormStyle := fsStayOnTop;
         FTransparentPanel := TPanel.Create (FTransparentForm);
         FTransparentPanel.Parent := FTransparentForm;
         FTransparentPanel.BevelInner := bvNone;
         FTransparentPanel.BevelOuter := bvNone;
         FTransparentPanel.Align := alClient;
         FTransparentPanel.Caption := 'transparent window';
         FTransparentPanel.Font.Color := clRed;
         FTransparentPanel.Font.Size := 16;
      end;
      FTransparentForm.Color := clBlue;
      FTransparentPanel.Color := VideoGrabber.ColorKey;
      VideoGrabber.SetWindowTransparency (FTransparentForm.Handle, true, VideoGrabber.ColorKey, false, 0);
      FTransparentForm.Show;
   end;
end;


See Also
Dual display TVideoRenderer AdjustPixelAspectRatio Display_Active Display_AlphaBlendEnabled Display_AlphaBlendValue Display_AutoSize Display_Embedded Display_FullScreen Display_Height Display_Left Display_Monitor Display_MouseMovesWindow Display_PanScanRatio Display_SetLocation Display_StayOnTop Display_Top Display_TransparentColorEnabled Display_TransparentColorValue Display_VideoHeight Display_VideoPortEnabled Display_VideoWidth Display_VideoWindowHandle Display_Width DualDisplay_Active DualDisplay_AlphaBlendEnabled DualDisplay_AlphaBlendValue DualDisplay_AutoSize DualDisplay_Embedded DualDisplay_FullScreen DualDisplay_Height DualDisplay_Left DualDisplay_Monitor DualDisplay_MouseMovesWindow DualDisplay_PanScanRatio DualDisplay_SetLocation DualDisplay_StayOnTop DualDisplay_Top DualDisplay_TransparentColorEnabled DualDisplay_TransparentColorValue DualDisplay_VideoHeight DualDisplay_VideoPortEnabled DualDisplay_VideoWidth DualDisplay_VideoWindowHandle DualDisplay_Visible DualDisplay_Width IsVideoPortAvailable Monitor_Primary_Index MonitorBounds MonitorsCount OnLeavingFullScreen SetParentWindow VideoDoubleBuffered VideoHeight_PreferredAspectRatio VideoRendererExternal VideoRendererExternalIndex VideoVisibleWhenStopped VideoWidth_PreferredAspectRatio