Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   image in picture control not displayed properly after moving (http://www.go4expert.com/forums/image-picture-control-displayed-t17743/)

dumbncool 30May2009 01:30

image in picture control not displayed properly after moving
 
2 Attachment(s)
Hello, I'm writing a MFC application to move a picture control when i press the "Next" button. (Please see attached screen-captures)

There is a dialog box on which there are 2 picture controls. When I press the Next button, the left picture control should move on top of the right picture control.
You can see I kept the code for moving the picture control in a for loop because I wanted a sort of animation effect.

As you can see from the attachments, after I move the image there are some vertical lines appearing. How do I make them go away?


Thank you.


Code:

void CShabbirDlg::OnBnClickedButton2()
{
    // TODO: Add your control notification handler code here
    if (pageNum <= 10) {
        pageNum++;

        CRect RRect, LRect;

        //Get the coordinates of the right and left picture control
                picPreview2.GetWindowRect(&RRect);
        picPreview.GetWindowRect(&LRect);

        //Move the left picture control to the right
        for (long int i = LRect.left; i > RRect.left; i -= 20) {
            picPreview.MoveWindow(i , LRect.top, LRect.Width(), LRect.Height());
        }
    }
   

}


SaswatPadhi 30May2009 07:07

Re: image in picture control not displayed properly after moving
 
Try updating the window after the move :

Code: c++

void CShabbirDlg::OnBnClickedButton2()
{
      // TODO: Add your control notification handler code here
      if (pageNum <= 10) {
            pageNum++;
            CRect RRect, LRect;

            //Get the coordinates of the right and left picture control
            picPreview2.GetWindowRect(&RRect);
            picPreview.GetWindowRect(&LRect);

            //Move the left picture control to the right
            for (long int i = LRect.left; i > RRect.left; i -= 20) {
                  picPreview.MoveWindow(i , LRect.top, LRect.Width(), LRect.Height());
            }
            this->Invalidate();
      }
}



All times are GMT +5.5. The time now is 18:27.