1

I want to add image in my rich textBox programatically.

The logic is, when i click a user Image will appear in RTB and below it his details will be shown. I am able to display the details but how to display the image before these data.

The image is in a picturebox control

//Here i want the image code so that it can appear above the following user details.
rtext.Text = "Number - 1"
rtext.AppendText(Environment.NewLine)
rtext.Text = rtext.Text + "Name - John Doe"
Django Anonymous
  • 2,987
  • 16
  • 58
  • 106
  • Similar question already posted on stackoverflow http://stackoverflow.com/questions/542850/how-can-i-insert-an-image-into-a-richtextbox – Saif Khan Oct 08 '12 at 05:21
  • @SaifKhan ok i have explored this one http://stackoverflow.com/a/568378/1182021 but i am a newbie and this answer is going out of my head, as its not simplified for a starter. Also it seems to be more theory than program.... Still i am trying to understand and doing just step by step... lets see what i can do. Meanwhile it would be a great help if you could give a broader insight over it. Thanks in advance :) – Django Anonymous Oct 08 '12 at 05:45

1 Answers1

3

You can skip all rtf stuff and work only with images and text. For example, if you want to have image and then some text, you could load that image into clipboard and then paste it into richTextBox:

Image img = Image.FromFile(filename); //if you want to load it from file...
Clipboard.SetImage(img);            
richTextBox1.Paste();
richTextBox1.AppendText("your text");
JleruOHeP
  • 10,106
  • 3
  • 45
  • 71