Want Mouse Coordinates To Be "Translated" To My Coordinates
Hi,
The following code below displays the mouse coordinates alongside the cursor.
My problem is this-- I my WinForm displays an XY coordinate graph. I need the
origin to display (0, 0) i.e "my coordinates" which which appear in screen coords
as (210, 210).
What is the best way to accomplish this?
I tried Transform but I can't seem to pass information between a Rect to a Region, or somehow get the Transformed coordinates to change what the mouse is doing.
I would like any way to do this. It doesn't have to use Transform.
Thanks a lot in advance. Code is below.
////////////////////////////////////////////////////////////////////
protected override void OnMouseMove(MouseEventArgs e)
{
// TODO: Add Form1.OnMouseMove implementation
base.OnMouseMove (e)
mousePoints = new Point(e.X, e.Y);
Invalidate();
}
protected override void OnPaint(PaintEventArgs e)
{
// TODO: Add Form1.OnPaint implementation
base.OnPaint (e);
Point screen = PointToScreen(mousePoints);
string location = screen.ToString();
e.Graphics.DrawString(location,
e.Graphics.DrawString(" " + (screen), new Font("Arial", 10, FontStyle.Bold),
SystemBrushes.ControlText,(PointF)mousePoints);
}
////////////////////////////////////////////////////////////////