-
April 19th, 2018, 08:16 AM
#1
CRichEditCtrl save to bitmap
Hi!
Can anyone help me with this.
I have a document in CRitchEditCtrl and i need to save it#s content to bitmap.
Best regards
-
April 19th, 2018, 11:52 AM
#2
Re: CRichEditCtrl save to bitmap
Playing with this MSDN sample may be a good start!
Victor Nijegorodov
-
April 23rd, 2018, 04:44 AM
#3
Re: CRichEditCtrl save to bitmap
Hi!
I already can create the bitmap file with the code.
Code:
CDC* dc = printDlg.m_DocBox.GetDC();
CDC MemDC;
MemDC.CreateCompatibleDC(dc);
CRect R;
GetClientRect(&R);
CBitmap Bitmap;
Bitmap.CreateCompatibleBitmap(dc,R.Size().cx,R.Size().cy);
CBitmap * B = MemDC.SelectObject(&Bitmap);
MemDC.BitBlt(0,0,R.Size().cx,R.Size().cy,dc,0,0,SRCCOPY);
//now we have a rendered bitmap, so save it
MemDC.SelectObject(B);
CreateBMPFile("Bitmap1.bmp",CreateBitmapInfoStruct(Bitmap),Bitmap,MemDC);
With this code i get the bitmap with the content of the active window. What i'd like is to get the content of the printDlg.m_DocBox (RitcEditCtrl on some window printDlg).
I was tryin to get the content of the m_DocBox fith the first line.
Can you help?
Last edited by 2kaud; April 23rd, 2018 at 05:07 AM.
Reason: Added code tags
-
April 23rd, 2018, 05:08 AM
#4
Re: CRichEditCtrl save to bitmap
[When posting code, please use code tags. Go Advanced, select the formatted code and click '#'].
Cheers!
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
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
|