Re: Mouse position question
Petit Eric <[email protected]>
| Newsgroups | gmane.comp.gnome.winforms |
|---|---|
| Message-ID | <[email protected]> |
I m not sure to completely understand your question, but did you look at screen bound ? yu should know, the position of the form on the screen and it size .... 2009/12/21 PFJ <[email protected]>: > > Hi, > > I can find where my mouse is clicked on a form using MouseEventArgs e.X and > e.Y and the world is good. However, if my window size is varied, the > position of X and Y will change depending on the size of the window. > > Is there a nice, simple way to find the X and Y position that will always > work? > > The logic I've tried so far. > > In LoadForm, get the initial size of the window and set this to be a scale > factor (scale_x, scale_y) of 1 (okay, that means needing the scale factor > variable to be a float which means casting around later). Set a resize event > up, so if the window size changes, the scale factor can be changed. > > When the mouse click happens though, the rescale number should be correct > (e.g. I have an eye at 150,150 with the scale = 1, if I half the window x > and y, the eye should be 75, 75, but I need it to be read as if it's still > 150,150). I've tried various conditions (if xscale<1 then divide else > multiply), but I'm getting nowhere. > > Any ideas on this? > > TTFN > > Paul > -- > View this message in context: http://old.nabble.com/Mouse-position-question-tp26874088p26874088.html > Sent from the Mono - WinForms mailing list archive at Nabble.com. > > _______________________________________________ > Mono-winforms-list maillist - [email protected] > http://lists.ximian.com/mailman/listinfo/mono-winforms-list > -- Cordially. Small Eric Quotations of the days: --------------------------------------------------------------------------- I have no special talents. I am only passionately curious _______________________________________________ Mono-winforms-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-winforms-list