BOOL CSplitter::OnPaint(HDC hDC) { CPaintDC dc(GetSafeHwnd()); // device context for painting CBrush cbr; CRect rcClient; GetClientRect(&rcClient); cbr.CreateSolidBrush(clrBg); CGDI MemDC; CBitmap m_BitmapMemDC; MemDC.CreateCompatibleDC(dc.m_hDC); m_BitmapMemDC.CreateCompatibleBitmap(dc.m_hDC,rcClient.Width(),rcClient.Height()); CBitmap *m_bitmapOld=new CBitmap(MemDC.SelectObject(&m_BitmapMemDC)); MemDC.FillRect(&rcClient,&cbr); DrawSplitter(m_rcSpplitter,m_rectLeft,m_rectRight,&MemDC); dc.BitBlt(0,0,rcClient.Width(),rcClient.Height(),MemDC.m_hDC, rcClient.left,rcClient.top,SRCCOPY); MemDC.SelectObject(m_bitmapOld); m_BitmapMemDC.DeleteObject(); MemDC.DeleteDC(); cbr.DeleteObject(); dc.DeleteDC(); m_bitmapOld->DeleteObject(); delete m_bitmapOld; return TRUE; }
void CGuiMiniSplitter::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default CRect m_rectCli; GetClientRect(m_rectCli); if (bIniciaArrastre==TRUE) { m_rcSplitterOld=m_rcSplitter; if (point.x < m_rectCli.left+50) m_rcSplitter.left=50; else if (point.x >m_rectCli.right-50) m_rcSplitter.left=m_rectCli.right-55; else { m_rcSplitter.left= point.x; m_rcSplitter.right=point.x+3; } CClientDC dc(this); DrawSplitter(m_rcSplitter,&dc); InvalidateRect(m_rcSplitterOld); RecalLayout(); } else CWnd::OnMouseMove(nFlags, point); }
void BSplitView::Draw(BRect updateRect) { // draw the splitters int32 draggedSplitterIndex = fSplitLayout->DraggedSplitter(); int32 count = fSplitLayout->CountItems(); for (int32 i = 0; i < count - 1; i++) { BRect frame = fSplitLayout->SplitterItemFrame(i); DrawSplitter(frame, updateRect, Orientation(), draggedSplitterIndex == i); } }
void COXTabViewContainer::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here CWnd* pWnd=GetActivePage(); if(pWnd!=NULL) { CRect rect; pWnd->GetWindowRect(rect); ScreenToClient(rect); if(m_rectPage!=rect && !rect.IsRectEmpty()) { CRgn rgnInTheory; CRgn rgnInReality; if(rgnInTheory.CreateRectRgnIndirect(m_rectPage) && rgnInReality.CreateRectRgnIndirect(rect)) { if(rgnInTheory.CombineRgn(&rgnInTheory,&rgnInReality, RGN_DIFF)!=ERROR) { CBrush* pBrush=NULL; CBrush brush; HBRUSH hBrush=(HBRUSH)(INT_PTR)::GetClassLongPtr(pWnd->m_hWnd, GCL_HBRBACKGROUND); if(hBrush==NULL) { if(brush.CreateSolidBrush(::GetSysColor(COLOR_WINDOW))) pBrush=&brush; else pBrush=dc.GetCurrentBrush(); } else { pBrush=CBrush::FromHandle(hBrush); } if(pBrush!=NULL) dc.FillRgn(&rgnInTheory,pBrush); } } } } DrawScrollButtons(&dc); DrawSplitter(&dc); DrawSizeBar(&dc); DrawTabBtnArea(&dc); // Do not call CWnd::OnPaint() for painting messages }
/** Draws all spliters. */ void SplitView::Draw(BRect update) { BView *child; for (int i = 0; i < CountChildren() -1; i++) { child = ChildAt(i); BRect frame = child->Frame(); if (fLayout.Mode() == B_HORIZONTAL) { frame.left = frame.right+1; frame.right = frame.left + fLayout.Spacing().x-2; } else { frame.top = frame.bottom+1; frame.bottom = frame.top + fLayout.Spacing().y-2; } if (frame.Intersects(update)) DrawSplitter(frame, child == fSelected && fDragged); } }
void CGuiSplitter::OnPaint() { CPaintDC dc(this); // device context for painting CBrush cbr; CRect rcClient; GetClientRect(&rcClient); cbr.CreateSolidBrush(clrBg); CDC MemDC; CBitmap m_BitmapMemDC; MemDC.CreateCompatibleDC(&dc); m_BitmapMemDC.CreateCompatibleBitmap(&dc, rcClient.Width(),rcClient.Height()); CBitmap* m_bitmapOld=MemDC.SelectObject(&m_BitmapMemDC); MemDC.FillRect(&rcClient,&cbr); DrawSplitter(m_rcSpplitter,m_rectLeft,m_rectRight,&MemDC); dc.BitBlt(0,0,rcClient.Width(),rcClient.Height(),&MemDC, rcClient.left,rcClient.top,SRCCOPY); MemDC.SelectObject(m_bitmapOld); m_BitmapMemDC.DeleteObject(); MemDC.DeleteDC(); }