moving figure in a range

Feb 11 2011 5:15 AM


I have a visual c# program to move channela bmp in y axis , it can moved upwards and downwards in a limit value , moving up to a limit value can be done while downwards cannot , can someone help me ?
 
        private void channela_MouseDown(object sender, MouseEventArgs e)
        {
            drag = true;
            y_down = e.Y;
        }

        private void Channela_MouseMove(object sender, MouseEventArgs e)
        {
            
            if (drag)
            {
                int topPosition = channela.Top + e.Y - y_down;
                   channela.Top = Math.Max(80, topPosition);
                       if (channela.Bottom == 477
                         {
                         channela.Top = Math.Max(477,topPosition);
                           return;
                          }
                           }
          
        }

Answers (1)