I tried both of them. It does not work. If i use InvalidateRect(NULL), the dialog box windows changes to its default color. Also i am using MFC. The relevant code is below. Please let me know if there is any problem in the code.
void CMapWindowDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CDC memdc;
CBitmap *oldmap, newmap;
RECT rect;
this->GetClientRect( &rect );
memdc.CreateCompatibleDC( &dc );
newmap.CreateCompatibleBitmap( &memdc, rect.right - rect.left, rect.bottom - rect.top);
oldmap = memdc.SelectObject( &newmap );
memdc.FillSolidRect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, RGB(255, 255, 255) );
DrawClient(memdc, rect);
dc.BitBlt(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, &memdc, 0, 0, SRCCOPY);
memdc.SelectObject( oldmap );
// Do not call CDialog::OnPaint() for painting messages
}
void CMapWindowDlg:

rawClient(CDC &dc, RECT &rect)
{
if( !m_DisplayFiles.GetCount() )
return;
for(int i = m_DisplayFiles.GetCount() - 1; i >= 0; i--)
{
if( !m_DisplayFiles.GetAt( m_DisplayFiles.FindIndex( i ) ).visible )
continue;
CString fileName = m_DisplayFiles.GetAt( m_DisplayFiles.FindIndex( i ) ).fileName;
CCellCoverage cellCov;
cellCov.DrawFile( fileName, dc, rect, visibleMin, visibleMax, m_Legend, Xsize, Ysize);
}
}
void CCellCoverage:

rawFile(CString filePath, CDC &dc, RECT &rect, strPoint &visibleMin, strPoint &visibleMax, CLegend &legend, long Xsize, long Ysize)
{
CFile filePtr;
CFileException e;
long temp1;
char temp4;
filePtr.Open(filePath.operator LPCTSTR(), CFile::modeRead | CFile::typeBinary, &e);
filePtr.Seek( sizeof(char) * 14 + sizeof(char) * 8 + sizeof(long) * 4, CFile::begin);
filePtr.Read( (void *) &noOfData, sizeof(long) );
filePtr.Seek( sizeof(char) * 14 + sizeof(char) * 8 + sizeof(long) * 4 + sizeof(long) + sizeof(unsigned char) + sizeof(char) * 20, CFile::begin);
for(long i = 0; i < noOfData; i++)
{
long X;
long Y;
strPositionStrength posData;
filePtr.Read( (void *) &temp1, sizeof(long) );
posData.point.Easting = temp1;
filePtr.Read( (void *) &temp1, sizeof(long) );
posData.point.Northing = temp1;
if(posData.point > visibleMax)
break;
if(posData.point < visibleMin)
continue;
filePtr.Read( (void *) &temp4, sizeof(char) );
posData.strength = temp4;
X = rect.left + ( rect.right - rect.left ) * ( posData.point.Easting + 10 - visibleMin.Easting ) / ( visibleMax.Easting + 10 - visibleMin.Easting );
Y = rect.top + ( rect.bottom - rect.top ) * ( posData.point.Northing - visibleMax.Northing - 10 ) / ( visibleMin.Northing - visibleMax.Northing - 10 );
COLORREF color = legend.GetLegendColor( posData.strength );
dc.FillSolidRect(X, Y, Xsize, Ysize, color);
}
filePtr.Close();
}
Thanks in advance
raochetan