[DevExpress Support Team: CLONED FROM T185111: Missing property from PictureEdit.PictureEditViewInfo]
Hi there.
Is it in the roadmap to provide a stable set of accessors to PictureEdit rendering information? Zoom, pan, and image boundary information is all necessary to transform mouse click locations to image space coordinates. This is a very common problem:
https://www.devexpress.com/Support/Center/Question/Details/Q396201
https://www.devexpress.com/Support/Center/Question/Details/Q456923
https://www.devexpress.com/Support/Center/Question/Details/Q480729
https://www.devexpress.com/Support/Center/Question/Details/Q581556
https://www.devexpress.com/Support/Center/Question/Details/Q468562
https://www.devexpress.com/Support/Center/Question/Details/T279293
https://www.devexpress.com/Support/Center/Question/Details/T185111
It seems that the common practice is to use the internal PictureEdit.PictureEditViewInfo, which is clearly a mistake because its interface is subject to change.
I use a PictureEdit extension method
Point ControlToImageCoordinates( this PictureEdit control, Point controlCoord ) { … }
which is used in click handlers like this:
private void Control1_MouseClick( Object sender, MouseEventArgs e ){
Point imageClickLocation = this.pictureEdit1.ControlToImageCoordinates( e.Location );
}
I would love it if something like that became part of the PictureEdit interface!
PictureEdit - Add the capability to get the correct mouse coordinate when zooming is used
Answers approved by DevExpress Support
We have implemented the functionality described in this ticket. It will be included in our next update(s).
Please check back and leave a comment to this response to let us know whether or not this solution addresses your concerns.
We have added two new methods: PictureEdit.ImageToViewport and PictureEdit.ViewportToImage.
- v15.1.8Download Official Update
Viewport is an excellent name - very clear. I have 2 questions:
- I notice those methods are not yet on the online documentation. When can we expect that to be updated?
- Does the method work in any SizeMode?
I just updated my project and tested this on one of my PictureEdits - it works as expected!! Thank you so much.
Hi,
>>I notice those methods are not yet on the online documentation. When can we expect that to be updated?
I have created a separate ticket (Documentation - Document PictureEdit's ImageToViewport and ViewportToImage methods) and passed it to our documentation team. You will receive a notification once these methods are documented.
>>2. Does the method work in any SizeMode?
You're right, it does. :)
Let me know if you have additional questions.
Hi,
Thank you for the suggestion. I have passed this ticket to our developers so they will consider implementing the required functionality. I can't guarantee that this functionality will be implemented in the upcoming minor. Once we have any progress with this ticket, we will inform you.
That's excellent! I've had a lot of difficulty with this issue, especially when the PictureEdit is in different SizeModes, because Clip, Stretch, and Zoom all change how control coordinates map to image coordinates.
Hello
I have created my own Image Editing Editor enhancing the PictureEdit and to calculate coordiantes for rubberbands and cropping I heavily rely on the ViewEdit Data.
I recently updated to 15.1. from 14.1 and the changes are heavy and my control does not work anymore due to the changes implemented internally :-(
Please implement this feature
rgds
Jan Thordsen
Hi Jan,
Thank you for your feedback. I understand how important it is to get internal information about a control. We will consider implementing this functionality in future versions of PictureEdit.
You are welcome to describe the changes you made and issues you faced in a separate ticket. We will do our best to resolve all the difficulties.
I would just like to add some clarification to this issue, because I'm running up against the problem again.
The ticket says "provide a stable set of accessors to **rendering information**," which is vague. The essence of the problem is that I need to convert to and from image space coordinates and PictureEdit control coordinates. This is useful for interacting with an image using the mouse, and for annotating specific parts of the image with small forms or other controls.
To see what I mean by image space coordinates vs. control coordinates, see attached image.
It would be nice if there were a pair of methods like these
Point PictureEdit.ImagePointToClient(Point)
Point PictureEdit.ClientPointToImage(Point)
which convert to and from the coordinates at the red crosses in the image.
Hope that clarifies things.