for(int index=0;index<=128;index++)
{
    int COLOR[3] = {0, 0, 143};
if (index <= 14)                      
{ COLOR[0] = 0;
COLOR[1] = 0;
COLOR[2] = 143 + index * 8;
}
else if (index > 14 && index <= 14 + 32)  
{
int differ = index - 14;
COLOR[0] = 0;
COLOR[1] = differ * 8;
COLOR[2] = 255; if (COLOR[1] > 255)                    
{
COLOR[1] = 255;
}
}
else if (index > 46 && index <= 46 + 32)    
{
int differ = index - 46;
COLOR[0] = differ * 8;
COLOR[1] = 255;
COLOR[2] = 255 - differ * 8;

if (COLOR[0] > 255)          
{
COLOR[0] = 255;
}

if (COLOR[2] < 0)             
{
COLOR[2] = 0;
}
}
else if (index > 78 && index <= 78 + 32)      
{
int differ = index - 78;
COLOR[0] = 255;
COLOR[1] = 255 - differ * 8;
COLOR[2] = 0;

if (COLOR[1] < 0)
{
COLOR[1] = 0;
}
}
else                          
{
int differ = index - 110;
COLOR[0] = 255 - differ * 8;
COLOR[1] = 0;
COLOR[2] = 0;
}

        CPen newPen(PS_SOLID, 2,RGB(COLOR[0], COLOR[1], COLOR[2]));
CPen *pOldPen = pDC->SelectObject(&newPen);
pDC->MoveTo(710, 340-2 * index);
pDC->LineTo(740, 340-2 * index);
newPen.DeleteObject();
pDC->SelectObject(&pOldPen);
}