1
Answer

moving figure in a range

LEUNG TING YU

LEUNG TING YU

13y
10.9k
1


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)