Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C# (http://www.go4expert.com/forums/c-sharp/)
-   -   moving the panel inside a form (like photoshop hand tool) (http://www.go4expert.com/forums/moving-panel-inside-form-photoshop-hand-t23673/)

Mr.President 26Oct2010 15:37

moving the panel inside a form (like photoshop hand tool)
 
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 ?

shabbir 26Oct2010 17:42

Re: moving the panel inside a form (like photoshop hand tool)
 
The best way to solve this is not to move the entire picture but just the outline.

Mr.President 26Oct2010 17:48

Re: moving the panel inside a form (like photoshop hand tool)
 
i din get u ?
do u mean I hav to drag only the border of the pictue ?

shabbir 26Oct2010 19:51

Re: moving the panel inside a form (like photoshop hand tool)
 
Yes.


All times are GMT +5.5. The time now is 09:47.