CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002
    Location
    Poland
    Posts
    48

    Question Rich Edit and WM_PRINT

    I have a rich edit control and I want to add some kind of a selection bar on the left side of it. I need to paint this bar on my own (gray background, images etc.).

    The problem is that the rich edit control doesn't seem to handle the WM_PRINT / WM_PRINTCLIENT messages properly. I tried to override the OnPaint function, render the control to a bitmap in memory and paint the bar:

    Code:
    CMyRichEditCtrl::OnPaint()
    {
       CPaintDC dc(this);
    	
       CRect rcClient;
       GetClientRect(&rcClient);
    
       CDC dcMem;
       dcMem.CreateCompatibleDC(&dc);
    
       CBitmap bmpMem;
       bmpMem.CreateCompatibleBitmap(&dc, rcClient.Width(), rcClient.Height());
    
       dcMem.SelectObject(&bmpMem);
    
       SendMessage(WM_PRINT, (WPARAM)dcMem.m_hDC, PRF_CLIENT | PRF_ERASEBKGND);
    
       rcClient.right = 16;
    
       dcMem.FillSolidRect(&rcClient, RGB(192,192,192));
    
       dc.BitBlt(0, 0, rcClient.Width(), rcClient.Height(), &dcMem, 0, 0, SRCCOPY);
    }
    It doesn't work (I tried with riched v1 and v2). Does anyone have an idea how to do this?
    regards,
    MiMec

  2. #2
    Join Date
    Aug 2002
    Location
    United States
    Posts
    729
    look @ RedrawWindow

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured