5 Answers, 1 is accepted
If you need the screen coordinates in the Document, you could use GetViewPointFromDocumentPosition() method which returns Point.
Then, you could access X and Y coordinate values of that point (clickPoint.X and clickPoint.Y)
However, If you need the screen coordinates in the RadRichTextBox control, you could attach to the MouseMove event of RadRichTextBox as follows:
You might find useful the following article about Positioning as well.
I hope this helps.
I tried to use this method. But each time, returned coordinates were incorrect.
My code for finding coordinates and move mouse on it:
Can you supporting where I did mistake?
Thank you for the provided code snippet. I used it in a sample application and realized what you mean by "incorrect coordinates".
Actually, GetViewPointFromDocumentPosition() method returns the coordinates within RadRichTextBox control, i.e. these coordinates are relative to the upper-left corner of RadRichTexBox control. See ReturnedCoordinates.png image from the attachment - the returned coordinates are within the red border.
Whereas Position property sets the cursor's position starting from the top-left corner of the screen. That said, if you have anything else the control, e.g window borders, RibbonBar, etc., you should have this in mind and include this offset in your calculations before setting the value to Position property.
Here is SearchRadButtonClickEventHandler() method modified according to the current positions of my screen:
Do not hesitate to get back to us if you have additional questions.
Thanck you very much!
I found universal solution. This could help someone in the future.
I am glad to hear that you found a solution and thank you for sharing it with us.
Do not hesitate to contact us if any other questions or issues arise.