Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9303269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:26:45+00:00 2026-06-18T23:26:45+00:00

I have a form and inside it I got a small Panel called Player

  • 0

I have a form and inside it I got a small Panel called Player. How can I “link” the panel to user’s mouse, so it will move as the mouse moves?

I’ve already subscribed Player_MouseMove to Player.MouseMove event but I can’t figure out how much has the mouse actually moved. Only way I can come up with is to have a such:

private Point previousLocation;

private void Player_MouseMove(object sender, MouseEventArgs e)
{
    int differenceX, differenceY;
    differenceX = e.X - previousLocation.X;
    differenceY = e.Y - previousLocation.Y;
    previousLocation = e.Location;
}

This seems pretty stupid, having an extra variable and calculating the difference everytime. Perfect way would be like Player.LinkToCursor(); or such, but if there’s no automated way, is there atleast a better way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T23:26:46+00:00Added an answer on June 18, 2026 at 11:26 pm

    Looking at http://msdn.microsoft.com/en-us/library/system.windows.forms.mouseeventargs.aspx I can’t see anything that would help you get this done any better.

    There is however one thing you could do:

    Point difference = e.Location - (Size)previousLocation;
    

    Vector-arithmetics 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a classifieds website, and inside each classified, there is a small form.
I've got a form input that has sample search keywords inside. When the user
I have a form that the user will use to enter in the title
I have one form and a button inside it, how can i toggle the
Due to some presentation needs I have got stuck with a h:form tag inside
I have got a class called Customers with an Arraylist inside to store information
I have a form loading inside my page and there is a button out
I have form in my page, I am using ajax.beginform(). Inside this form I
I have a page on a website that contains a secure form inside an
I have a webrequest that returns a html response which has form inside with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.