Slide effect is not smooth

I am trying to move a control to a different control position in a sliding effect. The code below works, but it is not smooth as expected. I know that redrawing has to happen for every pixel movement and this has everything to do with this issue. Is there anything I can do to make it smooth?

void changePage(Control currentPage, Control newPage)
{
    int curPageStartX = currentPage.Location.X;
    newPage.Location = new Point(currentPage.Size.Width + curPageStartX, currentPage.Location.Y);
    while (newPage.Location.X > curPageStartX)
    {
        currentPage.Location = new Point(currentPage.Location.X - 1, currentPage.Location.Y);
        newPage.Location = new Point(newPage.Location.X - 1, newPage.Location.Y);
    }
}

      

+3


source to share


1 answer


There are good articles on smooth resizing and positioning on codeproject and c # corner, check these links.

Smooth Resize and Reposition



Sliding effect in a Windows Form application

0


source







All Articles