dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: CRichEditCtrl save to bitmap

  1. #1
    Join Date
    Apr 2018
    Posts
    2

    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

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,251

    Re: CRichEditCtrl save to bitmap

    Playing with this MSDN sample may be a good start!
    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2018
    Posts
    2

    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

  4. #4
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    6,461

    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++17 Compiler: Microsoft VS2017 (15.8.7)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)