RichTextBox
-
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?
-
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?
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
-
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?
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);
-
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);
It works but the text I write is written under the picture. :(
-
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
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.