I'm working on a project in VB which has to do with document processing in Microsoft Word. I have difficulty on creating an ImageBox with certain size in a the document. Does anybody have an idea on how to do this? Can it even be done? The goal is to create the ImageBox and then insert an image to this box. The image must stretch and get the size of the ImageBox.
What I've done until now is this:
(...)
Dim NewSize As Size
NewSize = New Size(Width, Height)
ResizedImage = New Bitmap(ImageToInsert, NewSize)
(...)
WordDocument.AddPicture(DirectoryAddress & "\ResizedImage." & ImageExtension)
Though, what this code does, is to insert an image with specified size in the Word document. What I want is, the image to stretch and get the size of the ImageBox that will have been created. I hope I was clear enough.
Thanks in advance!
Thanks to @CindyMeister and @macropod I managed to create what I needed. So here is the answer:
Extra. What I was looking for, was to insert an image to an already designed frame in a word document. So for me the pre-designed frame was a one cell table. If you just want to add a frame around a picture then the following code should work just fine.