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 9173189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:31:53+00:00 2026-06-17T16:31:53+00:00

This is more of a why doesn’t this work question. I obviously must be

  • 0

This is more of a why doesn’t this work question. I obviously must be missing something because I cannot for the life of me figure out why calculating the width and height values give me the same static value that I started with. But when I substitute hardcoded values it works just fine. So obviously my calculations are bad but I cannot seem to figure out why. Can anyone help? If you need more info please ask.

 if(objectList[selectedIndex].Selected == true)
 {
      //The width would be mouselocationx - objectlocationx
      //The height would be mouselocationy - objectlocationy
      //Off set the position so it doesnt snap to mouse location
      //WHY THE *%$!! DOESNT THIS WORK!!?!?!?!?!?!?
      //int width = e.X - objectList[selectedIndex].X;
      //int height = e.Y - objectList[selectedIndex].Y;
      //Why is this so hard??
      //Point location = objectList[selectedIndex].Location;
      //location.X = e.X - (e.X - objectList[selectedIndex].Location.X);
      //location.Y = e.Y - (e.Y - objectList[selectedIndex].Location.Y);
      objectList[selectedIndex].X = e.Location.X - 12;
      objectList[selectedIndex].Y = e.Location.Y - 12;
      objectLocationXLabel.Text = "OBJX: " + objectList[selectedIndex].X.ToString();
      objectLocationYLabel.Text = "OBJY: " + objectList[selectedIndex].Y.ToString();
      panel1.Invalidate();
   }
  • 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-17T16:31:54+00:00Added an answer on June 17, 2026 at 4:31 pm

    It’s not at all clear what you want to do. But there are at least two issues with your commented code:

    location.X = e.X - (e.X - objectList[selectedIndex].Location.X);
    

    is equivalent to

    location.X = objectList[selectedIndex].Location.X;
    

    Point is a value type. So when you do this:

    Point location = objectList[selectedIndex].Location;
    location.X = ...;
    

    location is modified, but not objectList[selectedIndex].Location.

    Edit in response to comment: I think you must determine the offset in the MouseDown event, store it in a member and use it in MouseMove.

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

Sidebar

Related Questions

Ok, I'm going to try to make this more clear because my last question
This is more of an academic curiosity but I'm trying to figure out how
This code used to work but doesnt any more. i used a breakpoint, and
This is more of a design question. I have a template class, and I
This is more of a conceptual question, but it has actual ramifications. Going through
This is more of a correctness question. Say I have a table with a
This is more a style question. For CPU bound processes that really benefit for
This is more a conceptual question. Here is my current predicament; I am writing
This is more of a general design question, but it will be implemented in
This is more of a is this possible? question than one seeking help 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.