Results 1 to 5 of 5

Thread: Image and text transfering from 1 Rich Text Box to another

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    99

    Question Image and text transfering from 1 Rich Text Box to another

    Hi
    I want to transfer data from one rich text box to another
    but when i use
    RichTextbox2.text = RichTextbox1.text
    it transfer just text not images

    if there is any way to do so?

  2. #2
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Image and text transfering from 1 Rich Text Box to another

    Explore the RichTextBox properties. You'll see the rtf property. That's the one.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    99

    Re: Image and text transfering from 1 Rich Text Box to another

    if it is like this?
    Code:
     RichTextBox1.Rtf = RichTextBox2.Rtf
    I use this but its also not working

  4. #4
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Image and text transfering from 1 Rich Text Box to another

    It must work. Strange

    Check this out:
    http://www.codeproject.com/KB/edit/csexrichtextbox.aspx

    This is another quote:
    In RTF, a picture is defined like this:

    '{' \pict (brdr? & shading? & picttype & pictsize & metafileinfo?) data '}' A question mark indicates the control word is optional. "data" is simply the content of the file in hex format. If you want to use binary, use the \bin control word.

    For instance:

    {\pict\pngblip\picw10449\pich3280\picwgoal5924\pichgoal1860 hex data}
    {\pict\pngblip\picw10449\pich3280\picwgoal5924\pichgoal1860\bin binary data}
    \pict = starts a picture group, \pngblip = png picture \picwX = width of the picture (X is the pixel value) \pichX = height of the picture \picwgoalX = desired width of the picture in twips

    So, to insert a picture, you just need to open your picture, convert the data to hex, load these data into a string and add the RTF codes around it to define a RTF picture. Now, you have a self contained string with picture data which you can insert in the RTF code of a document. Don't forget the closing "}"

    Next, you get the RTF code from your RichTextBox (rtbBox.Rtf), insert the picture at the proper location, and set the code of rtbBox.Rtf

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    99

    Re: Image and text transfering from 1 Rich Text Box to another

    Thanks cicatrix Dear

    this is the exactly thing that i need

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