[Mono-winforms-list] Mouse position question

Petit Eric surfzoid at gmail.com
Mon Dec 21 08:44:39 EST 2009


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 <pjohnson1 at uclan.ac.uk>:
>
> 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  -  Mono-winforms-list at lists.ximian.com
> 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


More information about the Mono-winforms-list mailing list