1

I'm trying to place an object to my cursor location, but there is a giant offset? Why?

private void Form1_MouseMove(object sender, MouseEventArgs e)
{
    if (moving == true)
    {
        panel1.Location = Cursor.Position;
    }
}
payo
  • 4,501
  • 1
  • 24
  • 32
Gregor Menih
  • 5,036
  • 14
  • 44
  • 66
  • 2
    Code samples speak louder than words :) – Khan Apr 03 '12 at 18:03
  • the offset is probably absolute to the desktop, and not relative to your window. But this is a crazy guess as you've given very little information. – payo Apr 03 '12 at 18:03

1 Answers1

0

Cursor.Position is "the cursor's position in screen coordinates". Use the MouseEventArgs, as shown in this dup

Community
  • 1
  • 1
payo
  • 4,501
  • 1
  • 24
  • 32