Hi,
is there any way to determine the current position of the cursor ("sometimes visible") on the screen; coordinates x, y?
-> T15B or RunTime ...
Thanks for reply
Joe
Position of the cursor
Re: Position of the cursor
Sure, it shouldnt be a problem...
I´m home right now so can´t try it on a panel but following should work.
If you want it in "Point" format
var cursorPos = System.Windows.Forms.Cursor.Position;
You can then access X/Y like this
int cursorPosX = cursorPos.X;
Or if you want X/Y as two INT:
var cursorPosX = System.Windows.Forms.Cursor.Position.X
var cursorPosY = System.Windows.Forms.Cursor.Position.Y
Best Regards
I´m home right now so can´t try it on a panel but following should work.
If you want it in "Point" format
var cursorPos = System.Windows.Forms.Cursor.Position;
You can then access X/Y like this
int cursorPosX = cursorPos.X;
Or if you want X/Y as two INT:
var cursorPosX = System.Windows.Forms.Cursor.Position.X
var cursorPosY = System.Windows.Forms.Cursor.Position.Y
Best Regards
-
- Posts: 13
- Joined: Mon Mar 11, 2013 8:48 am
Re: Position of the cursor
I was trying out a form popup utilizing this cursor position example. Things work dandy through debugging and running the code on Visual Studio with the output CF. But I get the error in the image below when I try and simulate the code in iX Devloper even though the "intelligent code completion" picks up on it. Any thoughts?
Also in just trying to do a pop up form, my end device (QTerm A7) locks up and restarts within a couple of second. Even something as simple as a MessageBox.Show has the same result. Any Ideas?
Thanks in advance.
-Joey
Also in just trying to do a pop up form, my end device (QTerm A7) locks up and restarts within a couple of second. Even something as simple as a MessageBox.Show has the same result. Any Ideas?
Thanks in advance.
-Joey
- Attachments
-
- Error.jpg (10.23 KiB) Viewed 11149 times
-
- CodeSnippet.jpg (68.18 KiB) Viewed 11149 times
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: Position of the cursor
If you switch your target to a PC, I bet your error will go away. If it does, it means that the code complete is using the .NET libraries rather than the Windows CE .NET libraries.
I have found that the code complete often times does than. The .NET Compact framework most likely doesn't have the Position property.
I have found that the code complete often times does than. The .NET Compact framework most likely doesn't have the Position property.
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Re: Position of the cursor
Sorry Jwphilippi, I didn´t mean try to fool you
I was simulating in a T12C project (looks just lika a T15B in the IDE).
Try use this instead and see if it works
Regards
I was simulating in a T12C project (looks just lika a T15B in the IDE).
Try use this instead and see if it works
Code: Select all
var cursorPos = Control.MousePosition;
Text1.Text = "X = " + cursorPos.X + " / Y = " + cursorPos.Y;
Regards
-
- Posts: 13
- Joined: Mon Mar 11, 2013 8:48 am
Re: Position of the cursor
Thank you Mark and Thank you Edmund. I am astounded by ya'lls awesomeness when it comes to programming these HMIs.