Currently, I am working on a project that requires me to draw a gradient-colored ellipse. The input is the base color of the ellipse. The logic is something like the following code fragment.
for (i=0; i<nGradient; i++)
clrCurrent = m_clrGradient[i];
m_pPen->CreatePen(PS_SOLID, 1, clrCurrent);
pOldBrush = pDC->SelectObject(m_pBrush);
pOldPen = pDC->SelectObject(m_pPen);
If the display mode was in 16-bit or 24-bit, the result looks great. However, if it was in 8-bit (256 color), the result looks ugly.
I thought it might be the palette problem. So, I tried to create a new palette and stick in all of the colors in m_clrGradient. Then selected the palette into the DC and had the DC to "Realize" it OK. But, I still get the same ugly result.
Basically, I have no anyother idea. Is there any one who knows why?
Thanks a lot.