Results 1 to 8 of 8

Thread: How can i view where is located the last letter in a RTB?

  1. #1

    Thread Starter
    Hyperactive Member DarkX_Greece's Avatar
    Join Date
    Jan 2004
    Location
    Athens (Greece)
    Posts
    315

    Exclamation 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!
    Short CV:
    1. Visual Basic 6 Programmer
    2. Web Expert


    Botonakis Web Services

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    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

  3. #3

    Thread Starter
    Hyperactive Member DarkX_Greece's Avatar
    Join Date
    Jan 2004
    Location
    Athens (Greece)
    Posts
    315

    Exclamation

    Screen location! Do you know something that it would help me?
    Short CV:
    1. Visual Basic 6 Programmer
    2. Web Expert


    Botonakis Web Services

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Something like this should work...
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function GetCaretPos Lib "user32" (lpPoint As POINTAPI) As Long
    4. Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, _
    5.                                                       lpPoint As POINTAPI) _
    6.                                                       As Long
    7.  
    8. Private Type POINTAPI
    9.     x As Long
    10.     y As Long
    11. End Type
    12.  
    13. Private Sub Command1_Click()
    14. Dim p As POINTAPI
    15.  
    16.     With RichTextBox1
    17.         .SelStart = Len(.Text)
    18.         .SetFocus
    19.        
    20.         Call GetCaretPos(p)
    21.         Call ClientToScreen(.hwnd, p)
    22.     End With
    23.    
    24.     MsgBox "X:" & p.x & "; Y:" & p.y
    25.    
    26. 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

  5. #5

    Thread Starter
    Hyperactive Member DarkX_Greece's Avatar
    Join Date
    Jan 2004
    Location
    Athens (Greece)
    Posts
    315
    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?
    Short CV:
    1. Visual Basic 6 Programmer
    2. Web Expert


    Botonakis Web Services

  6. #6
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171
    VB Code:
    1. Me.ScaleMode = vbPixels

    ?


    Has someone helped you? Then you can Rate their helpful post.

  7. #7

    Thread Starter
    Hyperactive Member DarkX_Greece's Avatar
    Join Date
    Jan 2004
    Location
    Athens (Greece)
    Posts
    315
    Thanks Manavo11!
    Short CV:
    1. Visual Basic 6 Programmer
    2. Web Expert


    Botonakis Web Services

  8. #8
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171


    Has someone helped you? Then you can Rate their helpful post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width