RichTextBox RightClick [modified]
-
[EDIT]We have a workaround now, because the workflow would result in other errors :-)[/EDIT] I should 'simulate' a left-click or set the cursor to the position of the mouse, when right clicking (popup contextmenu) is occuring. I tried mainly this:
mea = new MouseEventArgs(MouseButtons.Left, e.Clicks, e.X, e.Y, e.Delta);
OnMouseClick(mea);but that doesn't work. I also tried to move my cursor position:
Cursor.Position = new Point(e.X, e.Y);
but nothing works. My guess is that the context menu is ahead of me although I should think that OnMouseDown would be before the contextmenu request? How can I do this? Many thanks !
V.
Stop smoking so you can: Enjoy longer the money you save. Moviereview Archivemodified on Thursday, October 23, 2008 10:03 AM
-
[EDIT]We have a workaround now, because the workflow would result in other errors :-)[/EDIT] I should 'simulate' a left-click or set the cursor to the position of the mouse, when right clicking (popup contextmenu) is occuring. I tried mainly this:
mea = new MouseEventArgs(MouseButtons.Left, e.Clicks, e.X, e.Y, e.Delta);
OnMouseClick(mea);but that doesn't work. I also tried to move my cursor position:
Cursor.Position = new Point(e.X, e.Y);
but nothing works. My guess is that the context menu is ahead of me although I should think that OnMouseDown would be before the contextmenu request? How can I do this? Many thanks !
V.
Stop smoking so you can: Enjoy longer the money you save. Moviereview Archivemodified on Thursday, October 23, 2008 10:03 AM
hi use int index = RichTextBox.GetCharIndexFromPoint(Point pt); to get the position of the char under the mouse. use RichTextBox.SelectionStart = index; RichTextBox.SelectionLength = 0; // maybe this line is not necessary to move the cursor inside the textbox. regards