greg dorian

greg dorian

  • NA
  • 116
  • 0

Moving a panel in runtime code with error

Apr 25 2013 5:14 PM
I´m using this code for move my panel in a windowform;

// variables used
        private bool btnDown;
        private int offsetX;
        private int offsetY;

        private void pnlOrder_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                btnDown = true;
                offsetX = e.X;
                offsetY = e.Y;
            }
        }

        private void pnlOrder_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                btnDown = false;
            }
        }

        private void pnlOrder_Move(object sender, EventArgs e)
        {
            if (btnDown)
            {
                            
                pnlOrder.Left += e.X - offsetX;// here in e.X are you missing a using directive or an assembly reference? error
                pnlOrder.Top += e.Y - offsetY;// and here e.Y
are you missing a using directive or an assembly reference?
            }
        }
what is wrong with e.X and e.Y????

Answers (2)