1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

image in picture control not displayed properly after moving

Discussion in 'MFC' started by dumbncool, May 29, 2009.

  1. dumbncool

    dumbncool New Member

    Joined:
    May 27, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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());
            }
        }
        
    
    }
     

    Attached Files:

    Last edited by a moderator: May 30, 2009
  2. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,343
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    Try updating the window after the move :

    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());
                }
                this->Invalidate();
          }
    } 
     

Share This Page