ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 IsMouseOverBitmap function?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

933 Posts

Posted - May 29 2013 :  18:45:07  Show Profile  Reply
Hi!

Is there a quick built in function to detect if the mouse pointer is over the Bitmap (not over the background or outside the ImageEnView)? I hate writing all that GetCursorPos and ScreenToClient stuff. I did not find anything in the help file.

PeterPanino

933 Posts

Posted - May 29 2013 :  19:27:00  Show Profile  Reply
OK, I wrote my own:
function IsMousePointerOverIEVBitmap(AIEV: imageenview.TImageEnView): Boolean;
var
  p: TPoint;
begin
  GetCursorPos(p);
  p := AIEV.ScreenToClient(p);
  p.X := AIEV.XScr2Bmp(p.X);
  p.Y := AIEV.YScr2Bmp(p.Y);
  Result := (p.X >= 0) and (p.X < AIEV.Bitmap.Width) and (p.Y >= 0) and (p.Y < AIEV.Bitmap.Height);
end;
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: