-
Mar 31st, 2004, 06:31 AM
#1
Thread Starter
Hyperactive Member
How can i view where is located the last letter in a RTB?
Does anyone know how to find out where the last letter of a Rich Text Box is located?
For example: i have loaded a text into a Rich Text Box and the last letter's location in the Rich Text Box control is: Top: 100 Left: 80
I know that this is too difficult but i need it. If anyone knows something, please send your reply!
-
Mar 31st, 2004, 07:14 AM
#2
Do you mean location as in screen location, or as in row/column in the textbox?
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 31st, 2004, 07:33 AM
#3
Thread Starter
Hyperactive Member
Screen location! Do you know something that it would help me?
-
Mar 31st, 2004, 07:39 AM
#4
Something like this should work...
VB Code:
Option Explicit
Private Declare Function GetCaretPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, _
lpPoint As POINTAPI) _
As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Command1_Click()
Dim p As POINTAPI
With RichTextBox1
.SelStart = Len(.Text)
.SetFocus
Call GetCaretPos(p)
Call ClientToScreen(.hwnd, p)
End With
MsgBox "X:" & p.x & "; Y:" & p.y
End Sub
The x and y will be in pixels, if it matters to you.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 31st, 2004, 11:22 AM
#5
Thread Starter
Hyperactive Member
Thanks, now how can i move an other control in pixels. You told me how to find the pixels in the screen where the letter is, but if i want to move a control there how can i do it?
-
Mar 31st, 2004, 03:20 PM
#6
-
Mar 31st, 2004, 03:46 PM
#7
Thread Starter
Hyperactive Member
-
Mar 31st, 2004, 03:55 PM
#8
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|