Jump to content

MousePosition - Window Location


Recommended Posts

I'm using Visual C++ 2008 and am trying to create a context menu when clicking on a button, i have managed to get the context menu to show when the button is clicked however it appears offset to the window the same amount that the window is form the top left of the screen.

I'm going to be reusing the code for various other buttons so do not want to use any button specific names in the code. i know i can get it appearing where i want it if i could subtract the values of this->Location from this->MousePosition but have been unable to get the specific X and Y values from them , and cannot find any decent info on Point's so i can convert them to integers.

private: System::Void button_Click(System::Object^  sender, System::EventArgs^  e) {
contextMenuPCOptions->Show(this, this->MousePosition);
}

Any Help would be appreciated, thanks.

Edited by Cyber Axe
Link to comment
Share on other sites


I managed to figure out how to get the X and Y values though i now have the problem of that it seems to be offset to the curser the same amount as the width of the window border and the height of the window top border

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...