.H file
class CXTSplitterWndEx2 : public CXTSplitterWndEx
{
public:
CXTSplitterWndEx2();
virtual void
SetColors
(COLORREF crTL, COLORREF crBR, COLORREF crInside);
virtual void
SetMinMax
(UINT nMin, UINT nMax);
virtual void
OnDrawSplitter
(CDC* pDC,
ESplitType nType, const CRect& rectArg);
virtual void
StartTracking
(int ht);
protected:
COLORREF
m_crTopLeft, m_crBottomRight,
m_crInside;
UINT
m_nMin, m_nMax;
};
.CPP file
CXTSplitterWndEx2::CXTSplitterWndEx2()
{
m_crTopLeft = RGB(255, 255, 255);
m_crBottomRight = RGB(173, 170, 156);
m_crInside = RGB(239, 235, 222);
m_nMin = m_nMax = 0;
}
void CXTSplitterWndEx2::SetMinMax(UINT nMin, UINT nMax)
{
m_nMin = nMin;
m_nMax = nMax;
}
void CXTSplitterWndEx2::SetColors(COLORREF crTL, COLORREF crBR, COLORREF crInside)
{
m_crTopLeft = crTL;
m_crBottomRight = crBR;
m_crInside = crInside;
}
void CXTSplitterWndEx2::StartTracking(int ht)
{
CXTSplitterWndEx::StartTracking(ht);
// horizontal splitter, undocumented Microsoft values
if (ht >= 101 && ht <= 115)
{
m_rectLimit.top += m_nMin;
if (m_nMax != 0)
m_rectLimit.bottom -= (m_rectLimit.bottom - m_nMax);
}
// vertical splitter, undocumented Microsoft values
else if (ht >= 201 && ht <= 215)
{
m_rectLimit.left += m_nMin;
if (m_nMax != 0)
m_rectLimit.right -= (m_rectLimit.bottom - m_nMax);
}
}
void CXTSplitterWndEx2::OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rectArg)
{
if (pDC == NULL)
{
RedrawWindow(rectArg, NULL, RDW_INVALIDATE | RDW_NOCHILDREN);
return;
}
ASSERT_VALID(pDC);
if (nType == splitBar)
{
CRect rect = rectArg;
// Draw outside of rectangle.
pDC->Draw3dRect(rect, m_crTopLeft, m_crBottomRight);
rect.InflateRect(-GetSystemMetrics(SM_CXBORDER), -GetSystemMetrics(SM_CYBORDER));
// Draw inside of rectangle.
pDC->FillSolidRect(rect, m_crInside);
return;
}
}
|