void CSSplitter::DrawBar(BOOL bEraseOnly) { CWindowDC dc(m_pWndParent); CRect rcParent, rcThis; m_pWndParent->GetWindowRect(&rcParent); GetWindowRect(&rcThis); int OffsetX = rcThis.left - rcParent.left; int OffsetY = rcThis.top - rcParent.top; //CClientDC dc(this); CBrush brush(GetSysColor(COLOR_3DFACE)); CBrush* pOldBrush = dc.SelectObject(&brush); CRect rc; if (m_DrawedBarPos > 0)//Erase the previous { rc = GetSplitterRect(m_DrawedBarPos); rc.OffsetRect(OffsetX, OffsetY); dc.PatBlt(rc.left, rc.top, rc.Width(), rc.Height(), PATINVERT); } if (bEraseOnly) m_DrawedBarPos = 0; else { rc = GetSplitterRect(m_BarPos); rc.OffsetRect(OffsetX, OffsetY); dc.PatBlt(rc.left, rc.top, rc.Width(), rc.Height(), PATINVERT); dc.SelectObject(pOldBrush); m_DrawedBarPos = m_BarPos; } }
void CFastSplitter::DrawBar(BOOL bEraseOnly) { CClientDC dc(this); CBrush* pOldBrush = dc.SelectObject(&m_Brushes[m_mode == MOD_Normal ? COL_Normal : COL_Disabled]); //TRACE(_T("@1Split: %d Bar: %d oldBarPos: %d"), m_SplitterPos, m_BarPos, m_DrawedBarPos); if (m_DrawedBarPos > 0)//Erase the previous { //TRACE(_T("@1Erasing %d"), m_DrawedBarPos); CRect rc = GetSplitterRect(m_DrawedBarPos, TRUE); //ClientToScreen(&rc); //ClientToWindowRect(m_pWndParent->m_hWnd, &rc); //rc = GetSplitterRect(m_DrawedBarPos, TRUE); dc.PatBlt(rc.left, rc.top, rc.Width(), rc.Height(), PATINVERT); } if (bEraseOnly) m_DrawedBarPos = 0; else { //TRACE(_T("@1Drawing %d"), m_BarPos); //CRect rc = GetSplitterRect(m_BarPos, TRUE); CRect rc = GetSplitterRect(m_BarPos, TRUE); //ClientToScreen(&rc); //ClientToWindowRect(m_pWndParent->m_hWnd, &rc); dc.PatBlt(rc.left, rc.top, rc.Width(), rc.Height(), PATINVERT); m_DrawedBarPos = m_BarPos; } dc.SelectObject(pOldBrush); }
void CSSplitter::OnPaint() { CPaintDC dc(this); // device context for painting CGdiObject* oldPen = dc.SelectStockObject(BLACK_PEN); dc.FillSolidRect(&GetSplitterRect(m_SplitterPos), m_bkColor); //if (m_bVertSplitter) //{ // pDC->FillSolidRect(&m_rcVertSplitter, m_bkColor); // //pDC->MoveTo(m_rcVertSplitter.left, m_rcVertSplitter.top); // //pDC->LineTo(m_rcVertSplitter.left, m_rcVertSplitter.bottom); // //pDC->MoveTo(m_rcVertSplitter.right, m_rcVertSplitter.top); // //pDC->LineTo(m_rcVertSplitter.right, m_rcVertSplitter.bottom); //} //else //{ // pDC->FillSolidRect(&m_rcHorizSplitter, m_bkColor); // pDC->MoveTo(m_rcHorizSplitter.left, m_rcHorizSplitter.top); // pDC->LineTo(m_rcHorizSplitter.right, m_rcHorizSplitter.top); // pDC->MoveTo(m_rcHorizSplitter.left, m_rcHorizSplitter.bottom); // pDC->LineTo(m_rcHorizSplitter.right, m_rcHorizSplitter.bottom); //} dc.SelectObject(oldPen); }
void CSSplitter::MovePanes() { ASSERT(m_pFPane != NULL); ASSERT(m_pSPane != NULL); CRect rect; GetClientRect( &rect ); if (rect.Width() == 0 || rect.Height() == 0) return; //ApplyConstraints(newSplitterPos, rect.Width()); if (m_bVertSplitter) { m_pFPane->MoveWindow(rect.left, rect.top, m_SplitterPos, rect.Height(), TRUE); m_pSPane->MoveWindow(m_SplitterPos + m_nSplitterWidth, rect.top, rect.Width(), rect.Height(), TRUE); } else { m_pFPane->MoveWindow(rect.left, rect.top, rect.Width(), m_SplitterPos, TRUE); m_pSPane->MoveWindow(rect.left, m_SplitterPos + m_nSplitterWidth, rect.Width(), rect.Height(), TRUE); } InvalidateRect(GetSplitterRect(m_SplitterPos), TRUE); //m_pFPane->Invalidate(); //m_pSPane->Invalidate(); }
void TSplitter::GetChild1Rect(TRect& rect) const { TRect splitter; GetSplitterRect(fRatio, splitter); GetLocalBounds(rect); if (fVertical) rect.right = splitter.left; else rect.bottom = splitter.top; }
void TSplitter::GetChild2Rect(TRect& rect) const { TRect splitter; GetSplitterRect(fRatio, splitter); GetLocalBounds(rect); if (fVertical) rect.left = splitter.right - 1; else rect.top = splitter.bottom - 1; }
void TSplitter::DrawSplitterRect(TDrawContext& context) { context.SetForeColor(kMediumGrayColor); TRect r; GetSplitterRect(fRatio, r); if (fVertical) { context.SetForeColor(kWhiteColor); context.DrawLine(r.left, r.top, r.left, r.bottom); r.left += 1; r.right -= 1; context.SetForeColor(kLightGrayColor); context.PaintRect(r); context.SetForeColor(kMediumGrayColor); context.DrawLine(r.right - 1, r.top, r.right - 1, r.bottom); } else { context.SetForeColor(kWhiteColor); context.DrawLine(r.left, r.top, r.right, r.top); r.top += 1; r.bottom -= 1; context.SetForeColor(kLightGrayColor); context.PaintRect(r); context.SetForeColor(kMediumGrayColor); context.DrawLine(r.left, r.bottom - 1, r.right, r.bottom - 1); } }
BOOL CSSplitter::OnEraseBkgnd(CDC* pDC) { CGdiObject* oldPen = pDC->SelectStockObject(BLACK_PEN); pDC->FillSolidRect(&GetSplitterRect(m_SplitterPos), m_bkColor); //if (m_bVertSplitter) //{ // pDC->FillSolidRect(&m_rcVertSplitter, m_bkColor); // //pDC->MoveTo(m_rcVertSplitter.left, m_rcVertSplitter.top); // //pDC->LineTo(m_rcVertSplitter.left, m_rcVertSplitter.bottom); // //pDC->MoveTo(m_rcVertSplitter.right, m_rcVertSplitter.top); // //pDC->LineTo(m_rcVertSplitter.right, m_rcVertSplitter.bottom); //} //else //{ // pDC->FillSolidRect(&m_rcHorizSplitter, m_bkColor); // pDC->MoveTo(m_rcHorizSplitter.left, m_rcHorizSplitter.top); // pDC->LineTo(m_rcHorizSplitter.right, m_rcHorizSplitter.top); // pDC->MoveTo(m_rcHorizSplitter.left, m_rcHorizSplitter.bottom); // pDC->LineTo(m_rcHorizSplitter.right, m_rcHorizSplitter.bottom); //} pDC->SelectObject(oldPen); return TRUE; }