Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. RichTextBox

RichTextBox

Scheduled Pinned Locked Moved C#
comquestiondatabasedata-structureshelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Iulian Serban
    wrote on last edited by
    #1

    Hi I have tried to insert an image into a RichTextBox component but with no result. I have tried with CreateGraphics and drawn an image into it but when I type over the image, it dissapears. If I load a rtf file containing an image it works just fine but how can I include an image programmaticaly? I included a Com object RichTextBox6.0 and it has an array of ole objects with the add method but I don`t know what to give it as parameters. Add(object index,object key,object source,object objclass); Can anyone help me?

    M J 2 Replies Last reply
    0
    • I Iulian Serban

      Hi I have tried to insert an image into a RichTextBox component but with no result. I have tried with CreateGraphics and drawn an image into it but when I type over the image, it dissapears. If I load a rtf file containing an image it works just fine but how can I include an image programmaticaly? I included a Com object RichTextBox6.0 and it has an array of ole objects with the add method but I don`t know what to give it as parameters. Add(object index,object key,object source,object objclass); Can anyone help me?

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      You have to do it in Paint event I guess.Maybe you can subclass it and handle Paint yourself. Mazy **"If I go crazy then will you still Call me Superman If I’m alive and well, will you be There holding my hand I’ll keep you by my side with My superhuman might Kryptonite"**Kryptonite-3 Doors Down

      I 1 Reply Last reply
      0
      • I Iulian Serban

        Hi I have tried to insert an image into a RichTextBox component but with no result. I have tried with CreateGraphics and drawn an image into it but when I type over the image, it dissapears. If I load a rtf file containing an image it works just fine but how can I include an image programmaticaly? I included a Com object RichTextBox6.0 and it has an array of ole objects with the add method but I don`t know what to give it as parameters. Add(object index,object key,object source,object objclass); Can anyone help me?

        J Offline
        J Offline
        James McCutcheon
        wrote on last edited by
        #3

        Try this .... //load the image System.Drawing.Image myimage = System.Drawing.Image.FromFile("Sample.jpg"); //create a picture box PictureBox mypb = new PictureBox(); mypb.Image = myimage; //adjust the size mypb.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.richTextBox1.Controls.Add(mypb);

        I 1 Reply Last reply
        0
        • J James McCutcheon

          Try this .... //load the image System.Drawing.Image myimage = System.Drawing.Image.FromFile("Sample.jpg"); //create a picture box PictureBox mypb = new PictureBox(); mypb.Image = myimage; //adjust the size mypb.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.richTextBox1.Controls.Add(mypb);

          I Offline
          I Offline
          Iulian Serban
          wrote on last edited by
          #4

          It works but the text I write is written under the picture. :(

          1 Reply Last reply
          0
          • M Mazdak

            You have to do it in Paint event I guess.Maybe you can subclass it and handle Paint yourself. Mazy **"If I go crazy then will you still Call me Superman If I’m alive and well, will you be There holding my hand I’ll keep you by my side with My superhuman might Kryptonite"**Kryptonite-3 Doors Down

            I Offline
            I Offline
            Iulian Serban
            wrote on last edited by
            #5

            Yes but if I handle the Paint event then I have to do all the implementation of the text formatting and location and everything else.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups