J
Jed Ozone
In a TextBox, I'm using a MouseMove event to track the cursor position.
I want to get able to tell what text the current cursor position is at so I
can set the SelectionStart to that position.
private void textBox1_MouseMove(object sender, MouseEventArgs e)
{
Point p = textBox1.PointToClient(new Point(e.X, e.Y));
/* now what to do I do with Point to figure out the character
position in the text box??? */
SelectionStart = ????
}
The only solution I can figure out so far is to call the Windows API
user.dll and send a click event. This effectively sets the SelectionStart
position. Is there a way to send a click all within .NET and not use the
API?
Better yet would just to be able to determine directly the current character
position in the (multi-line) TextBox.
I want to get able to tell what text the current cursor position is at so I
can set the SelectionStart to that position.
private void textBox1_MouseMove(object sender, MouseEventArgs e)
{
Point p = textBox1.PointToClient(new Point(e.X, e.Y));
/* now what to do I do with Point to figure out the character
position in the text box??? */
SelectionStart = ????
}
The only solution I can figure out so far is to call the Windows API
user.dll and send a click event. This effectively sets the SelectionStart
position. Is there a way to send a click all within .NET and not use the
API?
Better yet would just to be able to determine directly the current character
position in the (multi-line) TextBox.