* * *

Author Topic: Kubuntu transparent window effect on Windows  (Read 230 times)

Ign_71

  • New member
  • *
  • Posts: 36
Kubuntu transparent window effect on Windows
« on: July 11, 2018, 12:03:14 pm »
Hi everybody.

I´m trying to obtain on a Windows application a similar effect that one on Kubuntu when moving or resizing a window on screen: when start moving/resizing the window it gets transparent, and when finishing moving/resizing the window it gets opaque again.

The first stage is easy. Something like this:

Code: Pascal  [Select]
  1. procedure TForm1.FormChangeBounds(Sender: TObject);
  2. begin
  3.      Self.AlphaBlend:=True;
  4.      Self.AlphaBlendValue:=150;
  5. end;    

But i can´t find an easy way to fit the second part, getting the window opaque when finishing moving or resizing. The ideal way would be the existence of something like a "OnEndChangeBounds" event and insert in it:

 
Code: Pascal  [Select]
  1.  Self.AlphaBlend:=False;
  2.  Self.AlphaBlendValue:=255;

Or the existence of something like a LM_ENDMOVE message. I´d tried also with the "Tform.OnMouseUp" event, but don´t works clicking/unclicking the window´s title bar.

So, please, can anybody provide any help, suggestion or idea about it? 

Thanks in advance.
« Last Edit: July 11, 2018, 12:04:57 pm by Ign_71 »

GetMem

  • Hero Member
  • *****
  • Posts: 3085
Re: Kubuntu transparent window effect on Windows
« Reply #1 on: July 11, 2018, 01:09:01 pm »
Quote
I´m trying to obtain on a Windows application a similar effect that one on Kubuntu when moving or resizing a window on screen: when start moving/resizing the window it gets transparent, and when finishing moving/resizing the window it gets opaque again.

Here you go:
Code: Pascal  [Select]
  1. uses windows;
  2.  
  3. var
  4.   PrevWndProc: WNDPROC;
  5.  
  6. function WndCallback(AHWND: HWND; uMsg: UINT; wParam: WParam; lParam: LParam): LRESULT; stdcall;
  7. begin
  8.   case uMsg of
  9.     WM_ENTERSIZEMOVE:
  10.     begin
  11.       Form1.AlphaBlend := True;
  12.       Form1.AlphaBlendValue := 150;
  13.     end;
  14.     WM_EXITSIZEMOVE:
  15.     begin
  16.       Form1.AlphaBlend := False;
  17.       Form1.AlphaBlendValue := 255;
  18.     end;
  19.   end;
  20.   Result := CallWindowProc(PrevWndProc, Ahwnd, uMsg, WParam, LParam);
  21. end;
  22.  
  23. procedure TForm1.FormCreate(Sender: TObject);
  24. begin
  25.   PrevWndProc := Windows.WNDPROC(SetWindowLongPtr(Self.Handle, GWL_WNDPROC, PtrInt(@WndCallback)));
  26. end;

Ign_71

  • New member
  • *
  • Posts: 36
Re: Kubuntu transparent window effect on Windows
« Reply #2 on: July 11, 2018, 08:04:44 pm »

Exactly, works fine !!

Thanks so much for help and for the code example.

Best regards.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus