rich edit controls and bitmaps

rich edit controls and bitmaps

Post by Glenn Dun » Sat, 03 Mar 2001 13:43:21



I have a CRichEditCtrl  which contains text (I want it to contain text and a
bitmap.)
I have a CBitmap which I normally display in the main window.

Is there any way I can append the CBitmap image to the end of the text in
the CRichEditCtrl?

It's trivial in a CRichEditView/Document architecture, but that's not what
my application has as its core element.
The idea is I wish to send the CRichedit data as a report to the printer (I
can print it, but not any graphics within it)

Thanks for any suggestions.

Glenn Dunn

 
 
 

rich edit controls and bitmaps

Post by Stev » Sat, 03 Mar 2001 15:32:43


You could put the bitmap into the clipboard, then paste it to the end of the
control using PasteSpecial.
Bet there is an easier way though.


Quote:> I have a CRichEditCtrl  which contains text (I want it to contain text and
a
> bitmap.)
> I have a CBitmap which I normally display in the main window.

> Is there any way I can append the CBitmap image to the end of the text in
> the CRichEditCtrl?

> It's trivial in a CRichEditView/Document architecture, but that's not what
> my application has as its core element.
> The idea is I wish to send the CRichedit data as a report to the printer
(I
> can print it, but not any graphics within it)

> Thanks for any suggestions.

> Glenn Dunn


 
 
 

rich edit controls and bitmaps

Post by Glenn Dun » Tue, 06 Mar 2001 07:49:50


I've worked out how to read in a bitmap from a file and dump it to the
control (found some convoluted code from the MSDN site). If I can figure out
what the hell the code is doing :), maybe i can adapt it to use a virtual
bitmap.


> You could put the bitmap into the clipboard, then paste it to the end of
the
> control using PasteSpecial.
> Bet there is an easier way though.



> > I have a CRichEditCtrl  which contains text (I want it to contain text
and
> a
> > bitmap.)
> > I have a CBitmap which I normally display in the main window.

> > Is there any way I can append the CBitmap image to the end of the text
in
> > the CRichEditCtrl?

> > It's trivial in a CRichEditView/Document architecture, but that's not
what
> > my application has as its core element.
> > The idea is I wish to send the CRichedit data as a report to the printer
> (I
> > can print it, but not any graphics within it)

> > Thanks for any suggestions.

> > Glenn Dunn

 
 
 

1. Rich edit control problem: bitmap font shows twice as wide as it should

Got a real strange one here.  I'm using a rich edit control as a
display window in an app I'm writing.  Because I need to display some
special characters that are not generally available, I have created a
bitmap font (.FNT file) that has the necessary characters in it.  I
can load this font correctly and display characters from it, except
they show up twice as wide as they should.

The font is 7 wide by 12 tall, and it's placed in the resource script
for my app.  Loading it is a two step operation.  In my WM_CREATE
handler, I do the following:

    GetModuleFileName(NULL, namebuff, MAX_PATH);
    AddFontResource(namebuff);
    SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);

and then in the rich edit control creation code, I do this:

    cf.cbSize = sizeof(CHARFORMAT);
    cf.dwMask = CFM_FACE | CFM_SIZE;
    cf.dwEffects = 0;
    cf.yHeight = 12;
    cf.bCharSet = DEFAULT_CHARSET;
    cf.bPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
    strcpy(cf.szFaceName, "SpecFont");

    my_displaybox->SetDefaultCharFormat(cf);

My best guess as to why it's failing is found in the notes about the
LOGFONT structure, lfWidth member: "If lfWidth is zero, the aspect
ratio of the device is matched against the digitization aspect ratio
of the available fonts to find the closest match, determined by the
absolute value of the difference."  Since I can't specify the width in
a CHARFORMAT structure, I'm guessing that it's setting it to 0, and
then trying to map my 7 by 12 font into the closest thing to a square
that it can hit (i.e. 1 to 1 aspect ratio), thus hitting a 14 by 12
layout.

Any ideas?  TIA.

2. Really Strange

3. need rich edit control for wince to use with EVC

4. Firewall Survey - Which Firewall is the best ? Have your say.

5. Rich Edit Control

6. Internet Explorer has quit working

7. rich edit control

8. .avi files won't play

9. coloring text in a rich edit control

10. How to popup the shortcut menu in a rich edit control?

11. need rich edit control for wince to use with EVC

12. Rich edit control problem (Focus not changing with tab)

13. Rich edit control 2.0 ?