, rcLeftBottom.top, rcLeftBottom.Width(), rcLeftBottom.Height(), memdc, 0, m_nHeight-m_rcBorder9grid.bottom, m_rcBorder9grid.left, m_rcBorder9grid.bottom,RGB(255,0,255));
//左边
CRect rcLeft;
rcLeft.left = rcItem.left;
rcLeft.right = rcLeft.left+m_rcBorder9grid.left;
rcLeft.top = rcItem.top+m_rcBorder9grid.top;
rcLeft.bottom = rcItem.bottom-m_rcBorder9grid.bottom;
::StretchBlt(hSrcDC, rcLeft.left, rcLeft.top, rcLeft.Width(), rcLeft.Height(), memdc, 0, m_rcBorder9grid.top, m_rcBorder9grid.left, m_nHeight-m_rcBorder9grid.top-m_rcBorder9grid.bottom, SRCCOPY);
//顶边
CRect rcTop;
rcTop.left = rcItem.left+m_rcBorder9grid.left;
rcTop.right = rcItem.right-m_rcBorder9grid.right;
rcTop.top = rcItem.top;
rcTop.bottom = rcTop.top+m_rcBorder9grid.top;
::StretchBlt(hSrcDC, rcTop.left, rcTop.top, rcTop.Width(), rcTop.Height(), memdc, m_rcBorder9grid.left, 0, m_nWidth-m_rcBorder9grid.left-m_rcBorder9grid.right, m_rcBorder9grid.top, SRCCOPY);
//右边
CRect rcRight;
rcRight.right = rcItem.right;
rcRight.left = rcRight.right-m_rcBorder9grid.right;
rcRight.top = rcItem.top+m_rcBorder9grid.top;
rcRight.bottom = rcItem.bottom-m_rcBorder9grid.bottom;
::StretchBlt(hSrcDC, rcRight.left, rcRight.top, rcRight.Width(), rcRight.Height(), memdc, m_nWidth-m_rcBorder9grid.right, m_rcBorder9grid.top, m_rcBorder9grid.right, m_nHeight-m_rcBorder9grid.top-m_rcBorder9grid.bottom, SRCCOPY);
//底边
CRect rcBottom;
rcBottom.left = rcItem.left+m_rcBorder9grid.left;
rcBottom.right = rcItem.right-m_rcBorder9grid.right;
rcBottom.bottom = rcItem.bottom;
rcBottom.top = rcBottom.bottom-m_rcBorder9grid.bottom;
::StretchBlt(hSrcDC, rcBottom.left, rcBottom.top, rcBottom.Width(), rcBottom.Height(), memdc, m_rcBorder9grid.left, m_nHeight-m_rcBorder9grid.bottom, m_nWidth-m_rcBorder9grid.left-m_rcBorder9grid.right, m_rcBorder9grid.bottom, SRCCOPY);
//中心
CRect rcCenter;
rcCenter.left = rcItem.left+m_rcBorder9grid.left;
rcCenter.right = rcItem.right-m_rcBorder9grid.right;
rcCenter.top = rcItem.top+m_rcBorder9grid.top;
rcCenter.bottom = rcItem.bottom-m_rcBorder9grid.bottom;
int nMode = ::SetStretchBltMode(hSrcDC,HALFTONE);
::StretchBlt(hSrcDC, rcCenter.left, rcCenter.top, rcCenter.Width(), rcCenter.Height(), memdc, m_rcBorder9grid.left, m_rcBorder9grid.top, m_nWidth-m_rcBorder9grid.left-m_rcBorder9grid.right, m_nHeight-m_rcBorder9grid.top-m_rcBorder9grid.bottom, SRCCOPY);
::SetStretchBltMode(hSrcDC,nMode);
::DeleteDC(memdc);
}
return TRUE;
}
为了更清楚,现把顶边代码去掉看看:
通过控件自绘,你能够按照自己的需要和想法来实现一些酷炫的界面外观。人靠衣装,佛靠金装,一个好的软件产品也需要精致的外表,至少在审美上要满足用户的需求,提高用户体验。
|