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
 Problem with mouse coords and rulers

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
MrDeveloper Posted - Sep 27 2021 : 11:02:31
Hello

I noticed something in the following experiment:

As an example, exactly at the mouse cursor position inside the TImageEnView I want to create a ellipse shape layer (fix 50px size for this example) via the OnMouseDown event. Do you have any idea what would be a better event for this task?

I have chosen the center of the circle for the origin. But if, for example, the ruler is displayed on the left, the X coordinates from the event are not correct. They have exactly the offset from the width of the ruler.

Of course this can be worked around as seen below, but I think if depending on how the vert/horz rulers are visible, the X and Y coordinates should already be passed to the correct mouse positions or not?

The simple code snippet below only works correct for view 100% of course. So how we can get the correct mouse position "inside" the control canvas area (depening on zoom, rulers etc.)? So that the circle can be always placed correctly on the center point of the mouse cursor position.


procedure TMainForm.ImageEnViewMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  ImageEnView.LayersAddEx(ielkShape,
    (X-ImageEnView.RulerParams.VertWidth) - 25,
     Y - 25,
     50,
     50);
end;


Thanks a lot!
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Sep 27 2021 : 20:22:35
Hi

Please use XScr2Bmp/YScr2Bmp to convert screen values (X,Y or MouseDown) to bitmap values:

https://www.imageen.com/help/TImageEnView.XScr2Bmp.html
https://www.imageen.com/help/TImageEnView.YScr2Bmp.html

Nigel
Xequte Software
www.imageen.com