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

moving the panel inside a form (like photoshop hand tool)

Discussion in 'C#' started by Mr.President, Oct 26, 2010.

  1. Mr.President

    Mr.President New Member

    Code:
            int x;
            int y;
            private void panel1_MouseMove(object sender, MouseEventArgs e)
            {
                    if (e.Button == MouseButtons.Left) 
                    {
                           panel1.Top += (e.Y - y); 
                           panel1.Left += (e.X - x);
                         } 
            }
    
            private void panel1_MouseDown(object sender, MouseEventArgs e)
            {
                     if (e.Button == MouseButtons.Left)
                    {
                           x = e.X;
                           y = e.Y;
                    }
            }
    
    

    I have added a picture in the panel and now its like google maps the panel is moving but the problem is it isn't smooth !

    when I move vertically no problem panel moves smoothly, horizontally also ok
    but wen it comes 2 angle wise move I mean 45 degree move the panel flikers it vibrates

    pls advice me on how to make this ryt i mean how to move smoothly ?
     
  2. shabbir

    shabbir Administrator Staff Member

    The best way to solve this is not to move the entire picture but just the outline.
     
  3. Mr.President

    Mr.President New Member

    i din get u ?
    do u mean I hav to drag only the border of the pictue ?
     
  4. shabbir

    shabbir Administrator Staff Member

Share This Page