Bug Report T308073
Visible to All Users

PictureEdit - Scrollbars' value is applied incorrectly when the PictureEdit.Properties.ShowScrollBars property is set to false

created 9 years ago

I am trying to implement a control that shuffles among a set of images, displaying the current on a Picture edit.
The images are always of the same size. I want the size mode to be Clip.
I want to have the ability to zoom in and out and when I move to the next or the previous image, I want to maintain the zoomed location (zoom percent is maintained).
I shuffle among the images using PageDown and Up. So I use the following code.

C#
private void m_ctrlDevXPictureEdit_Properties_KeyDown( object sender, KeyEventArgs e ) { if( e.KeyData == Keys.PageDown && CurrentImageIndex < m_images.Count - 1 ) { CurrentImageIndex++; } else if( e.KeyData == Keys.PageUp && CurrentImageIndex != 0 ) { CurrentImageIndex--; } else { return; } var vvalue = m_ctrlDevXPictureEdit.VScrollBar.Value; var hvalue = m_ctrlDevXPictureEdit.HScrollBar.Value; m_ctrlDevXPictureEdit.Image = m_images[ CurrentImageIndex ]; m_ctrlDevXPictureEdit.VScrollBar.Value = vvalue; m_ctrlDevXPictureEdit.HScrollBar.Value = hvalue; }

If I have visible Scroll bars the above code works but one can see a slight jerking of the scroll bars every time the image changes (probably
because of the double value changing). This can be annoying and I want to avoid it.
If I have invisible scroll bars, the code does not work. Every time the image changes, the scroll bars are reset to the centre of the frame.

Is there another way to achieve what I want to do?

Giorgos

Show previous comments (2)
DevExpress Support Team 9 years ago

    Hi Giorgos,

    I've discussed this behavior with our developers and we have come to the conclusion that it is not correct.
    The cause of this issue is that we use different mechanisms for scrollbars when they are visible and when they are not. We will add a new property to the PictureEdit control. With this property, changing will work as expected.
    While we are working on a hotfix, you can use the following approach as a workaround:

    C#
    pictureEdit1.Properties.ShowScrollBars = true; pictureEdit1.VScrollBar.Value = vvalue; pictureEdit1.HScrollBar.Value = hvalue; pictureEdit1.Properties.ShowScrollBars = false;
    GA GA
    Georgios Antonopoulos 9 years ago

      Hello Antonio,
      thank you for your reply. The workaround you suggested indeed works.

      GA GA
      Georgios Antonopoulos 9 years ago

        I was a bit fast do reply.
        The workaround DOES work, but the behavior is not smooth. The scrollbars appear and disappear instantly but not so fast that the user does not see it.
        Also, if I set the scrollbars to visible there is still this flickering I mentioned on the first post.
        I would like to note that I am using images of size 3500x1400, so assume that it takes some time for the control to load the images and relocate the scroll bars.

        Answers approved by DevExpress Support

        created 9 years ago (modified 9 years ago)

        We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

        Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

          Comments (1)
          DevExpress Support Team 9 years ago

            Hello,

            I couldn't find the other workaround for this issue. But we plan to update our control to 15.1.8 very soon. In this version, there are two new PictureEdit properties - HorizontalScrollPosition and VerticalScrollPosition. Use them instead of

            C#
            pictureEdit1.VScrollBar.Value = vvalue; pictureEdit1.HScrollBar.Value = hvalue;

            Should you have additional questions, let me know.

            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.