Board index » cppbuilder » Insert a Graphic in a RichEdit control

Insert a Graphic in a RichEdit control


2006-11-03 05:10:57 AM
cppbuilder34
Hello,
I have beat out my brains for 3 1/2 days now trying to find/figure out a
way to insert a graphic into a RichEdit control. What I am trying to
accomplish is insert a PostNet graphic after an address...
Bud Manz
012345 Fake Road
Anytown, OH 99999-9999
<insert PostNet graphic here>
I don't have enough hair to surrender anymore to my fists, so, if
someone would be kind enough to help me out, I would be very happy!
Here is a sample of my code...
[code]
TActiveBC *BC;
BC = new TActiveBC(frmPZRTXIN);
BC->BarText = ReplaceStr(ADOQuery1->FieldByName("Zip Code")->Text,"-","");
BC->BarType = PostNet;
AnsiString asGraphicFile = asOrigDir + "\\test.bmp";
BC->SaveToImageFile(20, 10, WideString(asGraphicFile), 20, dmInches);
Image1->Picture->Bitmap->LoadFromFile(asGraphicFile);
RichEdit1->Brush->Bitmap->Canvas->Draw(LineCount*PageCount, 0,
Image1->Picture->Graphic);
delete BC;
[/code]
... I am using the shareware version of ActiveBarCode.
Have a great day!
Bud Manz
PS- I am using Borland Developer Studio Architect 2006.
 
 

Re:Insert a Graphic in a RichEdit control

"Bud Manz" < XXXX@XXXXX.COM >wrote in message
Quote
I have beat out my brains for 3 1/2 days now trying to find/figure
out a way to insert a graphic into a RichEdit control.
Although it is technically possible, it is very complicated to implement.
You have to send the RichEdit an EM_GETOLEINTERFACE message to get an
IRichEditOle interface pointer, and then call the
IRichEditOle::InsertObject() method. InsertObject() takes a REOBJECT
structure as input. REOBJECT requires you to provide your own IOleObject,
IStorage, and IOleClientSite interfaces to manage the inserted object.
Have a look at Robert Dunn's website instead. He has already written code
to handle all of this for you:
home.att.net/~robertdunn/Yacs.html
Look at the TRichEditOle class, which exposes OLE operations for a standard
TRichEdit component.
Gambit
 

Re:Insert a Graphic in a RichEdit control

Remy Lebeau (TeamB) wrote:
Quote
"Bud Manz" < XXXX@XXXXX.COM >wrote in message
news:454a5edf$ XXXX@XXXXX.COM ...

>I have beat out my brains for 3 1/2 days now trying to find/figure
>out a way to insert a graphic into a RichEdit control.

Although it is technically possible, it is very complicated to implement.
You have to send the RichEdit an EM_GETOLEINTERFACE message to get an
IRichEditOle interface pointer, and then call the
IRichEditOle::InsertObject() method. InsertObject() takes a REOBJECT
structure as input. REOBJECT requires you to provide your own IOleObject,
IStorage, and IOleClientSite interfaces to manage the inserted object.

Have a look at Robert Dunn's website instead. He has already written code
to handle all of this for you:

home.att.net/~robertdunn/Yacs.html

Look at the TRichEditOle class, which exposes OLE operations for a standard
TRichEdit component.


Gambit


Thanks, Gambit!
I have downloaded it and will give it a try.
Bud
 

{smallsort}