Thursday 15 April 2010

c# - Knowing the point location of the caret in a Winforms TextBox? -


I should know the precise point location in my window where the current is still carpet so that I can pop a small window down The text (similar to Intelligence or Spellchecker) is that the GetPositionFromCharIndex does not seem to work on the text box. This is what I am trying to do:

  point pt = mtextbox Pt.Y = (int) math. Ceiling (mTextBox.Font.GetHyight ()); MListBox.Location = pt;  

However, GetPositionFromCharIndex always returns (0, 0) for TextBoxes (apparently it is not implemented for the Recharge box). Although this function (and this code) works fine for RichTextBoxes, I do not want to migrate my remaining code from Rich Textbox to text box, while RichTextBox / TextBox as a full LAST resort There are so many inconsistencies with that I have to rewrite the big part of my code lot in order to do this.

Is there a Winforms magician who knows how to do this?

If you do not mind using Win32-API to get the correct position.


No comments:

Post a Comment