-
Jun 10th, 2019, 11:26 PM
#1
Thread Starter
Hyperactive Member
How To Use FileDialog To Add Image To RichTextBox Without Clipboard?
I have been searching around and can't seem to find what I am looking for. I would like to add an image to my richtextbox via a filedialog but have only found examples that copy the image to the clipboard first and then paste it to the richtextbox. I would rather just load the image directly to the richtextbox. How is this done? I am trying to do something like this:
Code:
richtextbox1.AppendText(OpenFileDialog1.FileName)
This only loads the file string and does not actually load the image itself.
I realize appendtext is probably not what I need for this I tried others like selectedrtf, rtf..
I went through all of the commands for richtext and could not find anything that would work or seem to work.
Last edited by DreamWarrior77; Jun 10th, 2019 at 11:30 PM.
-
Jun 10th, 2019, 11:36 PM
#2
Re: How To Use FileDialog To Add Image To RichTextBox Without Clipboard?
Originally Posted by DreamWarrior77
How is this done?
It isn't, which is why you couldn't find examples of it. The RichTextBox doesn't provide an interface for that so you'd have to do it by knowing how to manipulate the RTF data directly.
-
Jun 11th, 2019, 12:11 AM
#3
Thread Starter
Hyperactive Member
Re: How To Use FileDialog To Add Image To RichTextBox Without Clipboard?
I see ok, but assuming I wanted to load the standard .jpg, .bmp. png, .gif formats what method would you recommend for achieving this?
-
Jun 11th, 2019, 09:31 AM
#4
Re: How To Use FileDialog To Add Image To RichTextBox Without Clipboard?
Usually you should use a bitmap. This can been converted into many object and many formats back and forth.
ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·
-
Jun 11th, 2019, 06:55 PM
#5
Re: How To Use FileDialog To Add Image To RichTextBox Without Clipboard?
If you use the Image.FromFile method, a Bitmap object (Bitmap inherits Image) will be created for all those file formats.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|