In case you are interested, I got a working example of how to have a form
change transparency when mouse over is done.  I had to use a mixture of
Form1.ClientOrigin and Form1.Left and Form1.Width to get it working
correctly.

Why?  Because evidently when the mouseleave event fires the mouse position
does not have the consistent postions in all 4 directions.  Exiting to the
top and the left use different measures than exiting to the right and
bottom.  Note this may be because I used a form with
BorderStyle:=bsToolWindow

If anyone has a simpler and more general solution I would be grateful...


procedure TForm1.FormMouseEnter(Sender: TObject);
begin
        Form1.AlphaBlendValue:=TransparencyActive;
end;

procedure TForm1.FormMouseLeave(Sender: TObject);
const
borderSize:integer=4;  //allow 4 pixels for border of form...
var
formpt,mousept:Tpoint;
begin
  formpt:=Form1.ClientOrigin;
  mousept:=mouse.CursorPos;
  with Form1 do
  begin
    if (mousept.x > formpt.X) and
      (mousept.y > formpt.Y) and
      (mousept.X <  Left+Width-BorderSize) and
      (mousept.Y < Top + Height-BorderSize)
    then
      //still in form
      AlphaBlendValue:=TransparencyActive
    else
      AlphaBlendValue:=TransparencyIdle;
  end;
end;

John

_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to