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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TImageEnView: IsMouseWithinImageBoundaries?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
PeterPanino Posted - Feb 27 2023 : 04:46:05
In ImageEnView.OnMouseMove, I need to detect whether the mouse pointer is inside or outside the image boundaries. It seems there is no explicit function to detect this. How can this be done?
2   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Feb 27 2023 : 20:11:33
Hi Peter

Yes, that looks good.

Nigel
Xequte Software
www.imageen.com
PeterPanino Posted - Feb 27 2023 : 05:16:49
I just now wrote this function that can be called from OnMouseMove:

function TformMain.IsMouseWithinImageBoundaries(const X, Y: Integer): Boolean;
begin
  Result := False;

  var bx := ImageEnView1.XScr2Bmp(X, False);
  var by := ImageEnView1.YScr2Bmp(Y, False);

  if (bx >= 0) and
     (bx < ImageEnView1.IEBitmap.Width) and
     (by >= 0) and
     (by < ImageEnView1.IEBitmap.Height)
  then Result := True;
end;


I think it should be declared as inline?

Is this correct? Is there a better/shorter way to detect this?