Try to implement some object in richtextbox selected text centered top of the selected line(s);
Let me demostrate with an example.
" The dog was come and go "
this is the sample sentence. with mouse or with keyboard the users select the " dog was come " and the cursor is positioned after the letter of " e| ".
what i try to get , the blinking cursor position but based on the object ( in this case the object is richtextbox ) , but getting the position of the cursor as X,Y Cordinates instead of getting a index.
(0,0)
------y|
--------| >|<
--------|
--------|--------x
--------|
--------|
--------|
this cordinates of the richtext box showed at above also the cursor is >|< mark like this , how can i get the X,Y cordinates from Richtextbox.
Thanks.
the text
" T|he dog was come and go "
probably you see there is a " | " character after " T ", what i need in that position. Based on the richtextbox control SIZE as rectangle ( lets say from (0,0) to (40,80) ) an the text of the " the dog ... " one , in the line of 8 and column of 12 ( just as an example ) , when the text cursor in the position of " T| " like. the expecting return is as a size (X,Y) something like ( 34,62 ).
am ia clear for know ??
Okay , here's some Q's and things to say.
Are u clicked when the MOUSE cursor on the Richtextbox TEXT CURSOR
Is this work on Win Form project or something else
when i totaly copy and paste your code to the richtextbox_selectionchanged event and timer , the results same
In a random .NET 4.8 project, I just added code in
richTextBox1_MouseUp
for the test, then control.PointToScreen to transform client coordinates returned from
GetPositionFromCharIndex
to screen coordinates
to display a simple Rectangle + text at this position with GDI+