Exemplo n.º 1
0
// =====
// Helper function to swap palettes...
// ==
BOOL
RealizeSysPalette(CClientDC &dc)
{
	// if user loaded palette not loaded no realize
	if( gPalette == NULL )
		return FALSE;

	CPalette* pOldPal = dc.SelectPalette( gPalette, 0);
	if( pOldPal != NULL ) {
		int rCnt = dc.RealizePalette();

		dc.SelectPalette(pOldPal, 1);

		if( rCnt != 0 )
			afxDump << "QUERYNEWPALETTE  - The number of colors realized " << rCnt << "\n";
		else
			return FALSE;
	}
	else
		return FALSE;

	// we realized our palette so cause a redraw
	if( dc.GetWindow() != NULL )
		dc.GetWindow()->Invalidate(TRUE);

	// indicates that we realized our palette
	return TRUE;
}