Hi
-
Monday, August 04, 2008 8:48 AM
please let me know how to get the keyboard cursor position in c#.net????
I want to give a feature like when the user enter data ;i want to create a popup window underneath the position where the last key has been typed.
Using the cursor class in .NET i get only the mouse cursors x and y posistions,but not the current keyboard focus posistion.
Is there any way to retrive the keyboard blink cursor pos?
Thanks
prasanth.k
All Replies
-
Monday, August 04, 2008 9:54 AM
Hi!
This will give you the cursor position in a Windows Form: http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.position.aspx
Regards,
-
Tuesday, August 05, 2008 5:50 AM
Hi,
As i have already mentioned the Cursor.posistion.X gives the mouse cursor,not the current control with focus.
I have used the following code to test this.
private void timer1_Tick(object sender, EventArgs e)
{
Console.WriteLine(Cursor.Position.X);
Console.WriteLine(Cursor.Position.Y);
}
i have 20 textboxes in my Form1 ,but when i move from one textbox to another ,i am unable to get current focused controls posistion.
Any Help??
regards
prasanth.k
-
Tuesday, August 05, 2008 5:59 AM
To be more specific, trying to get the blinking cursor posistion from a command window.
regards
prasanth.k
-
Tuesday, August 05, 2008 7:55 AMThen get the X and Y of the control that has focus:
Prashanthmallu wrote: Hi,
As i have already mentioned the Cursor.posistion.X gives the mouse cursor,not the current control with focus.
I have used the following code to test this.
private void timer1_Tick(object sender, EventArgs e)
{
Console.WriteLine(Cursor.Position.X);
Console.WriteLine(Cursor.Position.Y);
}
i have 20 textboxes in my Form1 ,but when i move from one textbox to another ,i am unable to get current focused controls posistion.
Any Help??
regards
prasanth.k
Code Snippetforeach
(Control c in this.Controls){
if (c.Focused){
MessageBox.Show(c.Top + " " + c.Left);}
}


