Ticket T280657
Visible to All Users

PictureEdit - Add the capability to get the correct mouse coordinate when zooming is used

created 10 years ago

[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!

Show previous comments (2)

    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

    Alisher (DevExpress Support) 9 years ago

      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.

        Answers approved by DevExpress Support

        created 9 years ago (modified 9 years ago)

        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.

        Additional information:

        We have added two new methods: PictureEdit.ImageToViewport and PictureEdit.ViewportToImage.

          Comments (2)

            Viewport is an excellent name - very clear.  I have 2 questions:

            1. I notice those methods are not yet on the online documentation.  When can we expect that to be updated?
            2. 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.
            Alisher (DevExpress Support) 9 years ago

              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.

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.