本文整理汇总了C++中CGraphic::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ CGraphic::Draw方法的具体用法?C++ CGraphic::Draw怎么用?C++ CGraphic::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGraphic
的用法示例。
在下文中一共展示了CGraphic::Draw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDraw
void CEx_DrawView::OnDraw(CDC* pDC)
{
// TODO: add draw code for native data here
CEx_DrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
m_bufferDC.BitBlt(0, 0, m_size.cx, m_size.cy, pDC, 0, 0, WHITENESS);
DrawGraphic(&m_bufferDC);
if (pDoc->m_sel != -1)
{
ASSERT(pDoc->m_sel >= 0 && pDoc->m_sel < pDoc->m_obArray.GetSize());
CGraphic* P = Convert_To_Graphic(pDoc->m_obArray[pDoc->m_sel]);
ASSERT_VALID(P);
P->Draw(&m_bufferDC);
m_bufferDC.SelectObject(GetStockObject(WHITE_BRUSH));
P->DrawSelectedEdge(&m_bufferDC);
if (pDoc->m_bShowTab)
{
CString str;
int bkMode = m_bufferDC.SetBkMode(TRANSPARENT);
str.Format(_T("%d"), pDoc->m_sel);
m_bufferDC.SelectObject(&m_tabFont);
m_bufferDC.TextOut(P->m_pt1.x, P->m_pt1.y, str);
}
}
pDC->BitBlt(0, 0, m_size.cx, m_size.cy, &m_bufferDC, 0, 0, SRCCOPY);
}
示例2: DrawGraphic
void CEx_DrawView::DrawGraphic( CDC* pDC, int skip /*= -1*/ )
{
CEx_DrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CString str;
BOOL bShowHidden = pDoc->m_bShowHidden;
for (int i = 0; i < pDoc->m_obArray.GetSize(); i++)
{
CGraphic* p = Convert_To_Graphic(pDoc->m_obArray[i]);
if (i == skip || (!bShowHidden && p->m_bHidden))
{
continue;
}
p->Draw(pDC);
if (pDoc->m_bShowTab) GraphicDrawTab(pDC, p, i);
}
}
示例3: OnMouseMove
void CEx_DrawView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CEx_DrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
m_ptLocalScroll = GetScrollPosition();
CPoint ptLocal = point + m_ptLocalScroll;
if (m_bLButtonDown)
{
CClientDC dc(this);
switch (pDoc->m_GM.m_DrawType)
{
case SELECT:
if (m_pMoveTarget)
{
if (m_bFirstMove && m_bLButtonDown)
{
if (m_bCtrlDown && !m_bSizingMode)
{
static GraphicMember GM;
m_pMoveTarget->UpdateData(&GM, FALSE);
m_pMoveTarget = CGraphic::CreateGraphic(&GM);
m_pMoveTarget->m_lpszName.Format(_T("%s_%d"), m_pMoveTarget->GetName(), ++pDoc->m_createID);
pDoc->WriteLog(CGraphicLog::GOS_ADD, m_pMoveTarget, pDoc->m_obArray.GetSize());
pDoc->m_sel = pDoc->m_obArray.GetSize() - 1;
pDoc->UpdateAllViews(NULL, 0x4000);
pDoc->UpdateAllViews(NULL, 0x4001);
m_bDup = TRUE;
}
m_backDC.BitBlt(0, 0, m_size.cx, m_size.cy, NULL, 0, 0, WHITENESS);
DrawGraphic(&m_backDC, pDoc->m_sel);
}
static CPoint offset;
offset = point;
offset -= m_ptOriginHit;
if (m_bSizingMode)
{
if (m_sizingX) *m_sizingX = ptLocal.x;
if (m_sizingY) *m_sizingY = ptLocal.y;
}
else
{
m_pMoveTarget->m_pt1 = m_ptCurTarget1 + offset;
m_pMoveTarget->m_pt2 = m_ptCurTarget2 + offset;
}
m_bufferDC.BitBlt(0, 0, m_size.cx, m_size.cy, NULL, 0, 0, WHITENESS);
m_bufferDC.BitBlt(0, 0, m_size.cx, m_size.cy, &m_backDC, 0, 0, SRCCOPY);
m_pMoveTarget->Draw(&m_bufferDC);
m_bufferDC.SelectObject(GetStockObject(WHITE_BRUSH));
m_bufferDC.SelectObject(GetStockObject(BLACK_PEN));
m_pMoveTarget->DrawSelectedEdge(&m_bufferDC);
if (pDoc->m_bShowTab) GraphicDrawTab(&m_bufferDC, m_pMoveTarget, pDoc->m_sel);
dc.BitBlt(0, 0, m_size.cx - m_ptLocalScroll.x, m_size.cy - m_ptLocalScroll.y, &m_bufferDC,
m_ptLocalScroll.x, m_ptLocalScroll.y, SRCCOPY);
}
break;
case CURVE:
pDoc->m_GM.m_pts.Add((CPoint)(ptLocal - pDoc->m_GM.m_pt1)); // 相对位置
m_bufferDC.SelectObject(&m_pen);
m_bufferDC.MoveTo(m_lastPt);
m_bufferDC.LineTo(point);
dc.BitBlt(0, 0, m_size.cx, m_size.cy, &m_bufferDC, 0, 0, SRCCOPY);
break;
case LINE:
case RECTANGLE:
case ELLIPSE:
CGraphic* pGraphic = CGraphic::CreateGraphic(&pDoc->m_GM);
ASSERT(pGraphic);
pGraphic->m_pt1 -= GetScrollPosition();
pGraphic->m_pt2 = point;
if (m_bShiftDown)
pGraphic->m_pt2.y = pGraphic->m_pt1.y + labs (pGraphic->m_pt2.x - pGraphic->m_pt1.x);
m_bufferDC.BitBlt(0, 0, m_size.cx, m_size.cy, NULL, 0, 0, WHITENESS);
m_bufferDC.BitBlt(0, 0, m_size.cx, m_size.cy, &m_backDC, 0, 0, SRCCOPY);
pGraphic->Draw(&m_bufferDC);
dc.BitBlt(0, 0, m_size.cx, m_size.cy, &m_bufferDC, 0, 0, SRCCOPY);
delete pGraphic;
break;
}
m_lastPt = point;
}
m_ptCursor = ptLocal;
m_bFirstMove = FALSE;
CScrollView::OnMouseMove(nFlags, point);
}