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
 How to prevent drawing a layer outside of the loaded image
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Flashcqxg

96 Posts

Posted - Jul 24 2023 :  06:13:30  Show Profile  Reply
I have allow users to draw a rectangular area, and the code is as follows. I want to achieve the following two points:
1. If the image is not loaded, users cannot use the mouse to draw layers;
2. After loading the image, the user can only draw a rectangular area layer within the size range of the image, and during the drawing process, the mouse cannot exceed the size range of the image.
Thanks.


ImgeEnView.MouseInteractLayers := [mlCreateShapeLayers];
IEGlobalSettings().DefaultLayerShape := iesRectangle;

xequte

38615 Posts

Posted - Jul 24 2023 :  18:16:00  Show Profile  Reply
Please see loPreventOutOfBounds for TImageEnView.LayerOptions:

https://www.imageen.com/help/TImageEnView.LayerOptions.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Flashcqxg

96 Posts

Posted - Jul 24 2023 :  18:48:05  Show Profile  Reply
Thank you, the second issue has been resolved. But if there is no image loaded, it is also necessary to disable mouse drag. Can this be achieved?
Go to Top of Page

xequte

38615 Posts

Posted - Jul 25 2023 :  00:48:28  Show Profile  Reply
Hi

Avoid applying MouseInteractLayers := [mlCreateShapeLayers]; until after image loading, e.g. by checking IsEmpty in the OnImageChange event:

http://www.imageen.com/help/TImageEnView.IsEmpty.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Flashcqxg

96 Posts

Posted - Jul 25 2023 :  01:54:23  Show Profile  Reply
Thanks.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: