本文整理汇总了C++中CGraphic::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ CGraphic::GetName方法的具体用法?C++ CGraphic::GetName怎么用?C++ CGraphic::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGraphic
的用法示例。
在下文中一共展示了CGraphic::GetName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnUpdate
void CEx_Ctrl::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
// TODO: Add your specialized code here and/or call the base class
if (lHint == 0x2000)
{
m_sel_graph.SetCurSel(GetDocument()->m_GM.m_DrawType);
OnSelGraph();
}
else if (lHint == 0x4000)
{
CObArray& arr = GetDocument()->m_obArray;
CString str;
CGraphic* P = NULL;
m_lists.ResetContent();
for (int i = 0; i < arr.GetSize(); i++)
{
P = Convert_To_Graphic(arr[i]);
str.Format(_T("%d - %s - %s"), i, P->GetName(), P->m_lpszName);
m_lists.InsertString(0, str);
}
}
else if (lHint == 0x4001)
{
int sel = GetDocument()->m_sel;
if (sel != -1)
{
m_lists.SetCurSel(m_lists.GetCount() - sel - 1);
}
}
}
示例2: OnCommand
BOOL CEx_DrawView::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
CEx_DrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (wParam == 0x200)
{
GraphicDeleteById(pDoc->m_sel);
pDoc->m_sel = -1;
return TRUE;
}
if (wParam == 0x201)
{
ASSERT(pDoc->m_sel >= 0);
ConfigDlg dlg;
CGraphic* P = Convert_To_Graphic(pDoc->m_obArray[pDoc->m_sel]);
ASSERT_VALID(P);
CRect rt;
P->GetRect(rt);
P->UpdateData(&dlg.m_GM, FALSE);
CGraphic* pSave = CGraphic::CreateGraphic(&dlg.m_GM);
pSave->m_modifiedTime = dlg.m_GM.m_modifiedTime;
dlg.m_typeName = P->GetName();
if (dlg.DoModal() == IDOK)
{
if (dlg.m_GM.m_bHidden) pDoc->m_sel = -1;
P->UpdateData(&dlg.m_GM);
pDoc->WriteLog(CGraphicLog::GOS_UPDATE, pSave, pDoc->m_sel);
pDoc->UpdateAllViews(NULL, 0x4000);
pDoc->UpdateAllViews(NULL, 0x4001);
Invalidate();
}
else
{
delete pSave;
}
return TRUE;
}
if (wParam == 0x202)
{
GraphicDeleteById(pDoc->m_sel);
pDoc->m_sel = -1;
return TRUE;
}
return CScrollView::OnCommand(wParam, lParam);
}
示例3: OnLButtonUp
void CEx_DrawView::OnLButtonUp(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;
ReleaseCapture();
if (m_bLButtonDown)
{
m_bLButtonDown = FALSE;
pDoc->m_GM.m_pt2 = ptLocal;
if (pDoc->m_GM.m_DrawType != SELECT)
{
BOOL bCreate = TRUE;
if (pDoc->m_GM.m_DrawType == RECTANGLE || pDoc->m_GM.m_DrawType == ELLIPSE)
{
CRect rt;
rt.SetRect(pDoc->m_GM.m_pt1, pDoc->m_GM.m_pt2);
rt.NormalizeRect();
if (rt.Width() < 5 || rt.Height() < 5)
{
bCreate = FALSE;
}
}
if (bCreate)
{
// 创建新的对象
CGraphic* pGraphic = CGraphic::CreateGraphic(&pDoc->m_GM);
pGraphic->m_createTime = CTime::GetCurrentTime();
pGraphic->m_modifiedTime = pGraphic->m_createTime;
pGraphic->m_bHidden = FALSE;
pGraphic->m_lpszName.Format(_T("%s_%d"), pGraphic->GetName(), ++pDoc->m_createID);
ASSERT(pGraphic);
if (pDoc->m_GM.m_DrawType == CURVE)
{
pDoc->m_GM.m_pts.RemoveAll();
m_pen.DeleteObject();
}
else
{
if (m_bShiftDown)
pGraphic->m_pt2.y = pGraphic->m_pt1.y + labs (pGraphic->m_pt2.x - pGraphic->m_pt1.x);
}
CRect rt;
pGraphic->GetRect(rt);
InvalidateRect(&rt, TRUE);
pDoc->WriteLog(CGraphicLog::GOS_ADD, pGraphic, pDoc->m_obArray.GetSize());
pDoc->UpdateAllViews(NULL, 0x4000);
pDoc->UpdateAllViews(NULL, 0x4001);
}
}
else
{
if (m_pMoveTarget)
{
if (!m_bFirstMove) m_pMoveTarget->m_modifiedTime = CTime::GetCurrentTime();
static GraphicMember GM;
m_pMoveTarget->UpdateData(&GM, FALSE);
Convert_To_Graphic(pDoc->m_obArray[pDoc->m_sel])->UpdateData(&GM); // 修改坐标
if (m_pLogBuffer)
{
if (!m_bFirstMove || m_bSizingMode)
{
pDoc->WriteLog(CGraphicLog::GOS_UPDATE, m_pLogBuffer, pDoc->m_sel);
}
else
{
delete m_pLogBuffer;
m_pLogBuffer = NULL;
}
}
if (!m_bDup) delete m_pMoveTarget;
else m_bDup = FALSE;
m_pMoveTarget = NULL;
m_bSizingMode = FALSE;
}
}
}
m_bFirstMove = FALSE;
CScrollView::OnLButtonUp(nFlags, point);
}
示例4: OnContextMenu
void CEx_DrawView::OnContextMenu(CWnd* pWnd, CPoint point)
{
// TODO: Add your message handler code here
CEx_DrawDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
m_bContextMenu = TRUE;
if (pDoc->m_GM.m_DrawType == SELECT)
{
CPoint pt;
GetCursorPos(&pt);
ScreenToClient(&pt);
pt += m_ptLocalScroll;
BOOL bResult = FALSE;
GraphicHitTest(pt, bResult, m_iTrackID);
if (bResult && pDoc->m_sel == m_iTrackID && m_iTrackID != -1)
{
CGraphic* P = Convert_To_Graphic(pDoc->m_obArray[m_iTrackID]);
CRect rt;
P->GetRect(rt);
GraphicMember GM;
P->UpdateData(&GM, FALSE);
CMenu menu;
CString title;
GetCursorPos(&pt);
menu.CreatePopupMenu();
menu.AppendMenu(MF_STRING, 0x80, _T("----===== 画布信息 =====----"));
title.Format(_T("图布大小: %dx%d"), m_size.cx, m_size.cy);
menu.AppendMenu(MF_STRING, 0x81, title);
menu.AppendMenu(MF_STRING, 0x200, _T("----===== 操作命令 =====----"));
menu.AppendMenu(MF_STRING | MF_BYCOMMAND, 0x201, _T("编辑当前图形"));
menu.AppendMenu(MF_STRING | MF_BYCOMMAND, 0x202, _T("删除当前图形"));
menu.AppendMenu(MF_STRING, 0x100, _T("----===== 图形信息 =====----"));
title.Format(_T("自定义名称: %s"), GM.m_lpszName);
menu.AppendMenu(MF_STRING, 0x106, title);
title.Format(_T("图像类型: %s"), P->GetName());
menu.AppendMenu(MF_STRING, 0x101, title);
title.Format(_T("存放序号: %d"), m_iTrackID);
menu.AppendMenu(MF_STRING, 0x102, title);
title.Format(_T("节点数量: %d"), P->GetPts());
menu.AppendMenu(MF_STRING, 0x103, title);
title.Format(_T("图像大小: %dx%d"), rt.Width(), rt.Height());
menu.AppendMenu(MF_STRING, 0x104, title);
title.Format(_T("是否隐藏: %s"), GM.m_bHidden ? _T("是") : _T("否"));
menu.AppendMenu(MF_STRING, 0x107, title);
title.Format(_T("逻辑坐标: (%d, %d, %d, %d)"), rt.left, rt.top, rt.right, rt.bottom);
menu.AppendMenu(MF_STRING, 0x105, title);
menu.AppendMenu(MF_SEPARATOR);
title.Format(_T("创建时间: %s"), GM.m_createTime.Format("%c"));
menu.AppendMenu(MF_STRING, 0x300, title);
title.Format(_T("修改时间: %s"), GM.m_modifiedTime.Format("%c"));
menu.AppendMenu(MF_STRING, 0x301, title);
menu.AppendMenu(MF_SEPARATOR);
title.Format(_T("画笔类型: %s"), CGraphic::GetPenStyleById(GM.m_iPenStyle, FALSE));
menu.AppendMenu(MF_STRING, 0x125, title);
if (!IF_NULL_PEN(GM.m_iPenStyle))
{
title.Format(_T("画笔颜色: RGB(%d, %d, %d)"), GetRValue(GM.m_clrPen), GetGValue(GM.m_clrPen), GetBValue(GM.m_clrPen));
menu.AppendMenu(MF_STRING, 0x120, title);
title.Format(_T("画笔粗细: %d"), GM.m_iPenWidth);
menu.AppendMenu(MF_STRING, 0x122, title);
}
menu.AppendMenu(MF_SEPARATOR);
if (P->EnableBrush())
{
title.Format(_T("画笔类型: %s"), CGraphic::GetBrushStyleById(GM.m_iBrushStyle, FALSE));
menu.AppendMenu(MF_STRING, 0x400, title);
if (!IF_NULL_BRUSH(GM.m_iBrushStyle))
{
title.Format(_T("画刷颜色: RGB(%d, %d, %d)"), GetRValue(GM.m_clrBrush), GetGValue(GM.m_clrBrush), GetBValue(GM.m_clrBrush));
menu.AppendMenu(MF_STRING, 0x401, title);
}
}
menu.TrackPopupMenu(0, pt.x, pt.y, this);
}
}
else
{
pDoc->m_GM.m_DrawType = SELECT;
pDoc->UpdateAllViews(NULL, 0x2000);
}
}
示例5: OnLButtonDown
void CEx_DrawView::OnLButtonDown(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;
m_bLButtonDown = TRUE;
m_bContextMenu = FALSE;
SetCapture();
CClientDC dc(this);
UpdateWindow(); // 强制刷新
m_backDC.BitBlt(0, 0, m_size.cx, m_size.cy, NULL, 0, 0, WHITENESS);
m_backDC.BitBlt(0, 0, m_size.cx, m_size.cy, &dc, 0, 0, SRCCOPY);
if (pDoc->m_GM.m_DrawType != NONE)
{
pDoc->m_GM.m_pt1 = ptLocal;
m_lastPt = point;
pDoc->m_GM.m_pts.RemoveAll();
if (pDoc->m_GM.m_DrawType == CURVE)
{
GraphicMember* pGM = &pDoc->m_GM;
m_pen.DeleteObject();
m_pen.CreatePen(pGM->m_iPenStyle, pGM->m_iPenWidth, pGM->m_clrPen);
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);
}
}
else if (pDoc->m_GM.m_DrawType == SELECT)
{
BOOL bResult = FALSE;
int last_sel = pDoc->m_sel;
GraphicHitTest(ptLocal, bResult, pDoc->m_sel);
if (!bResult) { pDoc->m_sel = -1; TRACE("Hit NONE\n") ;}
else {
CGraphic* P = Convert_To_Graphic(pDoc->m_obArray[pDoc->m_sel]);
TRACE("Hit (%d,%d) in graphic [ID: %d TYPE: \"%s\" RECT: (%d,%d,%d,%d)]\n",
ptLocal.x, ptLocal.y, pDoc->m_sel, P->GetName(),
P->m_pt1.x, P->m_pt1.y, P->m_pt2.x, P->m_pt2.y);
}
if (last_sel != -1 && !m_bSizingMode)
{
if (last_sel == pDoc->m_obArray.GetSize()) last_sel--;
CRect rt;
Convert_To_Graphic(pDoc->m_obArray[last_sel])->GetRect(rt);
rt.OffsetRect(-GetScrollPosition());
InvalidateRect(&rt, TRUE);
}
if (pDoc->m_sel != -1)
{
ASSERT(m_pMoveTarget == NULL);
static GraphicMember GM;
Convert_To_Graphic(pDoc->m_obArray[pDoc->m_sel])->UpdateData(&GM, FALSE);
m_pLogBuffer = CGraphic::CreateGraphic(&GM);
m_pLogBuffer->m_modifiedTime = pDoc->m_GM.m_modifiedTime;
m_pMoveTarget = CGraphic::CreateGraphic(&GM);
if (last_sel == pDoc->m_sel) // 缩放
{
BOOL bRet = FALSE;
m_sizingX = NULL;
m_sizingY = NULL;
m_pMoveTarget->HitSizingTest(ptLocal, bRet, &m_sizingX, &m_sizingY);
if (bRet) m_bSizingMode = TRUE;
}
m_bufferDC.BitBlt(0, 0, m_size.cx, m_size.cy, NULL, 0, 0, WHITENESS);
m_bufferDC.BitBlt(m_ptLocalScroll.x, m_ptLocalScroll.y,
m_size.cx - m_ptLocalScroll.x, m_size.cy - m_ptLocalScroll.y, &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);
m_ptCurTarget1 = m_pMoveTarget->m_pt1;
m_ptCurTarget2 = m_pMoveTarget->m_pt2;
m_ptOriginHit = point;
}
}
m_bFirstMove = TRUE;
if (pDoc->m_sel != -1)
{
static CString strPane;
static CGraphic* P;
P = Convert_To_Graphic(pDoc->m_obArray[pDoc->m_sel]);
strPane.Format(_T("您选中了:%s"), P->GetName());
m_pBar->SetPaneText(0, strPane.GetBuffer(0));
}
else
//.........这里部分代码省略.........