我在静态文本控件上如果用MoveTo, LineTo画的话,正常显示,但是如果用SetPixel却不显示,这是为什么?
我重载了CStatic类,在OnPaint中:
CPaintDC dc(this);
memDC.CreateCompatibleDC(&dc) ;
memBitmap.CreateCompatibleBitmap(&dc, rect.Width(), rect.Height()) ;
oldBitmap = (CBitmap *)memDC.SelectObject(&memBitmap) ;
// ......................
for( int i = 0; i < itotal; i++ )
{
if( igreen < 0 )
igreen = 255;
if( iblue < 0 )
iblue = 255;
if( iyellow < 0 )
iyellow = 255;
COLORREF colline = RGB(igreen, iblue, iyellow);
memDC.SetPixel( 300+i, m_drawRect.top+i, colline );
igreen -= 10;
iblue -= 20;
iyellow -= 30;
}
//
dc.BitBlt(0, 0, rect.Width(), rect.Height(),
&memDC, 0, 0, SRCCOPY) ;
// end....
memDC.SelectObject(oldBitmap) ;
memBitmap.DeleteObject();
memDC.DeleteDC();