TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ervin423
NA
1
0
Want Mouse Coordinates To Be "Translated" To My Coordinates
Dec 31 2005 6:10 PM
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);
}
////////////////////////////////////////////////////////////////
Reply
Answers (
1
)
New BPM Tool - NetBpm
Creating a SQL Server Database Programmatically (ADO.NET)