本文整理汇总了C++中CGraphic::UpdateData方法的典型用法代码示例。如果您正苦于以下问题:C++ CGraphic::UpdateData方法的具体用法?C++ CGraphic::UpdateData怎么用?C++ CGraphic::UpdateData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGraphic
的用法示例。
在下文中一共展示了CGraphic::UpdateData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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);
}
}