Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I hope someone could help me with this problem:

 

I am trying to write a program in which when you type a character in a RichTextBox control, I want it to display a context menu just to the right of that. The user would then select what they want from the context menu and that would be inserted into the text box at the location of the cursor.

 

I dont know how to return the cursor location and use it to place the context menu there and how to insert text at the specific cursor location.

 

Any help is greatly appreciated.

 

Thank you!

  • *Experts*
Posted

You do not need to know the cursor's position to show the

ContextMenu, just set the ContextMenu property of the RTB to

your menu and it will pop up when the user right-clicks the

control.

 

As for the caret location, utilize the SelectionStart, SelectionLength,

and SelectedText properties in your code.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...