richedit控件的刷新问题
使用系统默认richedit控件的OnPaint处理没问题,但是当我自己通过TxDraw在OnPaint处理的时候光标后面的区域没刷新,不知道是不是用ITextServices的TxDraw处理OnPaint的时候还要做一些其他另外的操作,请各位大侠忙帮解决这个问题。我的OnPaint代码如下:
void CMyRichEdit::OnPaint()
{
//Default( );
//return;
CPaintDC dc(this); // device context for painting
CRect rcClient;
GetClientRect(rcClient);
CDC dcMemory;
//创建临时设备
if( !dcMemory.CreateCompatibleDC(&dc) )
{
CRichEditCtrl::DefWindowProc( WM_PAINT, (WPARAM)dc.m_hDC, 0 );
return;
}
CBitmap memBmp; //创建底图
memBmp.CreateCompatibleBitmap( &dc, rcClient.Width() , rcClient.Height() );
CBitmap* pOldBmp = dcMemory.SelectObject( &memBmp ); //底图选入临时设备环境
dcMemory.SelectStockObject(WHITE_BRUSH); //用白色背景填充底图
m_pITextServices->TxDraw( DVASPECT_CONTENT, // Draw Aspect
/*-1*/0, // Lindex
NULL, // Info for drawing optimazation
NULL, // target device information
dcMemory.m_hDC, // Draw device HDC
NULL, // Target device HDC
(RECTL*)&rcClient, // Bounding client rectangle
NULL, // Clipping rectangle for metafiles
NULL,
NULL, // Call back function
NULL, // Call back parameter
TXTVIEW_ACTIVE);
dc.BitBlt( rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(),
&dcMemory , 0 , 0 , SRCCOPY );
dcMemory.SelectObject(pOldBmp);
dcMemory.DeleteDC();
memBmp.DeleteObject();
}