}
else
{ // gripper at top
rcGrip.top -= m_cyGripper + 1;
rcGrip.bottom = rcGrip.top + 11;
rcGrip.right = rcBtn.left - 3;
}
rcGrip.InflateRect(bHorz ? 1 : 0, bHorz ? 0 : 1);
// draw the caption background
//CBrush br;
COLORREF clrCptn = m_bActive ?
::GetSysColor(COLOR_ACTIVECAPTION) :
::GetSysColor(COLOR_INACTIVECAPTION);
// query gradient info (usually TRUE for Win98/Win2k)
BOOL bGradient = FALSE;
::SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &bGradient, 0);
if (!bGradient)
pDC->FillSolidRect(&rcGrip, clrCptn); // solid color
else
{
// gradient from left to right or from bottom to top
// get second gradient color (the right end)
COLORREF clrCptnRight = m_bActive ?
::GetSysColor(COLOR_GRADIENTACTIVECAPTION) :
::GetSysColor(COLOR_GRADIENTINACTIVECAPTION);
// this will make 2^6 = 64 fountain steps
int nShift = 6;
int nSteps = 1 << nShift;
for (int i = 0; i < nSteps; i++)
{
// do a little alpha blending
int nR = (GetRValue(clrCptn) * (nSteps - i) +
GetRValue(clrCptnRight) * i) >> nShift;
int nG = (GetGValue(clrCptn) * (nSteps - i) +
GetGValue(clrCptnRight) * i) >> nShift;
int nB = (GetBValue(clrCptn) * (nSteps - i) +
GetBValue(clrCptnRight) * i) >> nShift;
COLORREF cr = RGB(nR, nG, nB);
// then paint with the resulting color
CRect r2 = rcGrip;
if (bHorz)
{
r2.bottom = rcGrip.bottom -
((i * rcGrip.Height()) >> nShift);
r2.top = rcGrip.bottom -
(((i + 1) * rcGrip.Height()) >> nShift);
if (r2.Height() > 0)
pDC->FillSolidRect(r2, cr);
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-36846-5.html
只用一招