void CDrawOleObj::Draw(CDC* pDC) { ASSERT_VALID(this); CDrawItem* pItem = m_pClientItem; if (pItem != NULL) { // draw the OLE item itself pItem->Draw(pDC, m_position); // don't draw tracker in print preview or on printer if (!pDC->IsPrinting() && !CDrawView::m_IsRecording) { // use a CRectTracker to draw the standard effects CRectTracker tracker; tracker.m_rect = m_position; pDC->LPtoDP(tracker.m_rect); if (c_bShowItems) { // put correct border depending on item type if (pItem->GetType() == OT_LINK) tracker.m_nStyle |= CRectTracker::dottedLine; else tracker.m_nStyle |= CRectTracker::solidLine; } // put hatching over the item if it is currently open if (pItem->GetItemState() == COleClientItem::openState || pItem->GetItemState() == COleClientItem::activeUIState) { tracker.m_nStyle |= CRectTracker::hatchInside; } tracker.Draw(pDC); } } }
void CLeftView::OnDraw(CDC* pDC) { CVEDoc* pDoc = GetDocument(); // ASSERT_VALID(pDoc); // TODO: この場所にネイティブ データ用の描画コードを追加します。 CPen myPen, *pOldPen; DWORD mdl_num; POSITION lpos, lpos2; CClass* pCls; CModule *pMdl, *pMdl2; CRectTracker rt; if(pDoc->ac < 0 || pDoc->ac >= pDoc->cls.GetCount()) return; TRACE("classes: %d, class # = %d ", pDoc->cls.GetCount(), pDoc->ac); pCls=(CClass*)pDoc->cls.GetAt(pDoc->cls.FindIndex(pDoc->ac)); TRACE("pCls = %x modules=%d\n", pCls, pCls->mdl.GetCount()); if(!(pCls->mdl.GetCount())) return; width = 0; height =0; lpos=pCls->mdl.GetHeadPosition(); while(lpos) { pMdl=(CModule*)pCls->mdl.GetNext(lpos); if (width < pMdl->rect.right) width=pMdl->rect.right+10; if (height < pMdl->rect.bottom) height=pMdl->rect.bottom+10; } CSize sizeTotal; // このビューのサイズの合計を計算します。 sizeTotal.cx = width; sizeTotal.cy = height; SetScrollSizes(MM_TEXT, sizeTotal); myPen.CreatePen(PS_SOLID, 1, RGB(0,0,0)); pOldPen = pDC->SelectObject(&myPen); pos = GetScrollPosition(); lpos=pCls->mdl.GetHeadPosition(); while(lpos) { pMdl=(CModule*)pCls->mdl.GetNext(lpos); sx=pMdl->rect.left; sy=pMdl->rect.top; ex=pMdl->rect.right; ey=pMdl->rect.bottom; pDC->Rectangle(pMdl->rect); pDC->DrawText(pMdl->name,pMdl->rect,DT_SINGLELINE|DT_CENTER|DT_VCENTER); for(j=0; j<pMdl->line.GetSize(); j++) { mdl_num = pMdl->line[j]; pDC->MoveTo((sx+ex)/2,ey); // このモジュールの下 lpos2=pCls->mdl.FindIndex(mdl_num); pMdl2=(CModule*)(pCls->mdl.GetAt(lpos2)); pDC->LineTo((pMdl2->rect.left + pMdl2->rect.right)/2, pMdl2->rect.top); // kのモジュールの上 } if(pMdl->recursive==TRUE) { pDC->MoveTo((sx+ex)/2, ey); pDC->LineTo((sx+ex)/2, ey+8); pDC->LineTo(sx-8, ey+8); pDC->LineTo(sx-8, sy-8); pDC->LineTo((sx+ex)/2, sy-8); pDC->LineTo((sx+ex)/2, sy); } } if(pDoc->am!=-1) { rt.m_nStyle = CRectTracker::resizeInside; lpos=pCls->mdl.FindIndex(pDoc->am); pMdl= (CModule*)pCls->mdl.GetAt(lpos); rt.m_rect = pMdl->rect; rt.m_rect.left -= pos.x; rt.m_rect.top -= pos.y; rt.m_rect.right -= pos.x; rt.m_rect.bottom -= pos.y; rt.Draw(pDC); } pDC->SelectObject(pOldPen); }