i just foud out how to add a picture to a RTB
rtb.OLEObjects.Add , , "bob.bmp"
but if i do so, a whole Menu is created at the top of the frame
in addition i can now edit the picture... resize and paint in it!!!!
I DONŽT WANT THAT ... i just need a simple picture that does not do anything despite beeing JUST there
what properties to change to archieve that?????
ChiefRedBull
03-16-2002, 02:34 AM
I think you can just paste from the clipboard into an RTB...
ClipBoard.GetData
quite bad way ... donŽt you think??
i would clear the clipboard... and if there are other apps using it...
--> problem....
HERE (http://www.geocities.com/xtremepad/Download.htm) is a link to a program that has this capability. Download the source code and check it out, I did. And yes it uses the clipboard to achive this.
HTH,
Orbity
thx.. iŽll have a look at it
divil
03-18-2002, 02:28 AM
The clipboard was the only decent way I found of putting a bitmap in to the RTB, although the bitmap can be resized by the user.
Remember to back up and restore the clipboard contents, then it won't matter than you're using it.
Volte
03-18-2002, 01:45 PM
There is a really complicated way to do this, using GetBitmapBits API, or a simpler method, loading the picture into a temporary DC and GetPixeling out of the picture. Then you need to use the RTF's built in \pict or some such function to manually build all the bits of the bitmap into the RichTextBox.
I have some code to do this, but I can't give it away freely. I will ask about it, and I may be able to throw a project together for you. It will be, however, insanely complicated...
Edit: I've been fooling with it myself, and can't seem to get it to work properly with any size of picture except 15x15... sorry. :( If I see anything, I'll tell you.
should be possible too to use the bitmap itself and convert it into RFT-format to insert it.... i once did that in pascal but iŽve no real clue of how RFT deals with it....
might also be faster
iŽll have some tries :)
e.g. this is a 64*64 bmp
{\object\objemb{\*\objclass Paint.Picture}{\*\objname Object1}\objw959\objh959{\*\objdata
01050000
02000000
07000000
50427275736800
00000000
00000000
40140000
424D3614000
....
01050000
00000000
}{\result {\pict\wmetafile8\picw1693\pich1693\picwgoal959\pichgoal959
01000
....
}}}
shouldŽnt be taht difficult to find out whats behind that code
(hope so)
i just have not that plenty of time :(
Garrett Sever
03-18-2002, 04:03 PM
Originally posted by VolteFace
It will be, however, insanely complicated...
Edit: I've been fooling with it myself, and can't seem to get it to work properly with any size of picture except 15x15... sorry. :( If I see anything, I'll tell you.
Insanely complicated indeed. I think I spent about 8 hours hacking together that example you are talking about. It sucked pretty bad, and its still a total enigma to me. Most of that has to do with my complete ignorance of metafile structures and how they are encoded into the RTF format.
I would prefer if you didn't give out that code just yet Volte. Please keep the cat in the bag a little while longer. ;)
Please forgive my ignorance, but I don't see why using the clipboard to do this is a bad idea. It certainly seems to be the simple way. Like Divil said replace the original contents after you finish if you are worried about having problems with other things on the clipboard.
Orbity