CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    May 2014
    Posts
    8

    Unhappy select and insirt picture in RichTextBox

    hi,
    i have a rich textbox and it contain a text, and i need to select the last line automatically by code. and i need to put a picture in the last line.
    any idea to help me.

    i use the below code :-

    PHP Code:
    ' in module 
    Option Explicit
    Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
        ByVal wMsg As Long, ByVal wParm As Long, IParam As Any) As Long
        Public Const WM_PASTE = &H302
        Private Const EM_GETLINECOUNT = &HBA
    '
    ------------------------------------------------------------------------------------

    in button

    Dim LineCount 
    As Long
    Clipboard
    .Clear
    Clipboard
    .SetData Image1.Picture
    SendMessage RichTextBox1
    .hwndWM_PASTE0&, 0
    this code is work but the picture come in the top( before text)

    and i need to put it after the last line of text.

    many thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: select and insirt picture in RichTextBox

    Create a .RTF MASTER with the picturebox and other placeholders. Then, it's easy to find/replace and insert images INTO the picturebox on the RTF that has it where it should be.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this 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

Featured