Re: Print Preview colors




"Arno" <Arno@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E825937E-79DF-4E94-8E8A-5A9FDE489E65@xxxxxxxxxxxxxxxx
> After further testing it appears that the problem isn't caused by the
amount
> of colours but has something to the scale of the image. (CDC::StretchBlt
> function ?)
> When I draw an image at 100% the colour is good. What adjustment should I
make
> to get this right? Printing goes fine at every scale.

I've had problems with StretchBlt() recently... solved them by first
StretchBlt()ing to a memDC, then BitBlt()ing... here's a snip:

<>
void View::OnDraw(CDC* pDC)
{

....


// make compatible dc for bitmap selection
CDC dcMemory;

// make intermediate bitmap
CBitmap interBM;

// init the bitmap to be compatible with pDC here...
interBM.CreateCompatibleBitmap(pDC, iHorzSize,iVertSize);// final sizes
desired

if (!dcMemory.CreateCompatibleDC(pDC))
AfxMessageBox("We were not able to create a compatible memDC!", MB_OK, 0);

CDC dcScreen;
if (!dcScreen.CreateCompatibleDC(NULL))// NULL makes screen-compatible DC
even if print here
AfxMessageBox("We were not able to create a compatible scrnDC!", MB_OK,
0);

CBitmap* pOldBitmap = dcMemory.SelectObject(&interBM);

// Paint the source image.to compatible memDC
CBitmap* p2OldBitmap = dcScreen.SelectObject(m_pbDrawBitmap);

// nWidth, etc source bm sizes
if
(!dcMemory.StretchBlt(0,0,iHorzSize,iVertSize,&dcScreen,0,0,nWidth,nHeight,S
RCCOPY))
AfxMessageBox("We were not able to StretchBlt!", MB_OK, 0);

// put the memory image into the main window DC
// this displays the bitmap in the main window
if (!pDC->BitBlt(iXOrigin, iYOrigin, iHorzSize,iVertSize, &dcMemory, 0, 0,
SRCCOPY))
AfxMessageBox("We were not able to BitBlt!", MB_OK, 0);

dcMemory.SelectObject(pOldBitmap);
dcScreen.SelectObject(p2OldBitmap);
// housekeeping!
interBM.DeleteObject();

</>
See if this helps...good luck!
__
Steve
..


.