Beispiel #1
0
 void mouseDown(ChessPieces cp, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         stackPoint.Push(new Point(cp.getX(), cp.getY()));
         stackPictureBox.Push(cp.pic.Name);
         if (cp.canmove == false)
         {
             if (cp.pic.Parent == pic_chessboard)
             {
                 cp.canmove = true;
                 x1 = MousePosition.X;
                 y1 = MousePosition.Y;
                 cp.getTemp();//纪录起始位置
             }
         }
     }
     else if (e.Button == MouseButtons.Right)
     {
         if (cp.canmove)
         {
             //MessageBox.Show("red");
             cp.goBack();
             pic_chessboard.Cursor = Cursors.Default;
             cp.canmove = false;
         }
     }
 }