By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,215 Members | 1,934 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,215 IT Pros & Developers. It's quick & easy.

Setting position of caret in Textbox based on pixel offset

P: n/a
I would like to set the caret position in a (single-line) textbox to a
position based on the number of pixels from the left of the control.

For example, I want the caret to be positioned 50 pixels from the left (or
as near to there as possible based on the characters in the control).

I basically have the position in which the user has positioned the mouse
cursor within the textbox, and want to react as if they had actually clicked
it. The information I have about the click is a Point object with an X/Y
coordinate relative to the top/left of the control.

I can easily set the caret to be a specific number of characters from the
start of the text, but haven't found any way to set it based on the pixel
position I want the caret to move to.

Any ideas?

Thanks in advance,


Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.