




已阅读5页,还剩5页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
贾长建源程序代码JCJView.cpp/ JCJView.cpp : implementation of the CJCJView class/#include stdafx.h#include JCJ.h#include JCJDoc.h#include JCJView.h#include MainFrm.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CJCJViewIMPLEMENT_DYNCREATE(CJCJView, CView)BEGIN_MESSAGE_MAP(CJCJView, CView)/AFX_MSG_MAP(CJCJView)ON_COMMAND(ID_MENUITEM32771, OnMenuitem32771)ON_COMMAND(ID_MENUITEM32772, OnMenuitem32772)ON_COMMAND(ID_MENUITEM32773, OnMenuitem32773)ON_COMMAND(ID_MENUITEM32774, OnMenuitem32774)ON_WM_MOUSEMOVE()ON_WM_TIMER()ON_COMMAND(ID_MENU_bitmap, OnMENUbitmap)ON_COMMAND(ID_MENU_textout, OnMENUtextout)ON_COMMAND(ID_MENU_draw, OnMENUdraw)/AFX_MSG_MAP/ Standard printing commandsON_COMMAND(ID_FILE_PRINT, CView:OnFilePrint)ON_COMMAND(ID_FILE_PRINT_DIRECT, CView:OnFilePrint)ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView:OnFilePrintPreview)END_MESSAGE_MAP()/ CJCJView construction/destructionCJCJView:CJCJView()x_b=0;flag=0;caidanID=32772,m=1;CJCJView:CJCJView()BOOL CJCJView:PreCreateWindow(CREATESTRUCT& cs)/ TODO: Modify the Window class or styles here by modifying/ the CREATESTRUCT csreturn CView:PreCreateWindow(cs);/ CJCJView drawingvoid CJCJView:OnDraw(CDC* pDC) text(pDC, 200,300,200,黑体, RGB(0,0,255),1232222222222);CJCJDoc* pDoc = GetDocument();ASSERT_VALID(pDoc);/ TODO: add draw code for native data here/ CJCJView printingBOOL CJCJView:OnPreparePrinting(CPrintInfo* pInfo)/ default preparationreturn DoPreparePrinting(pInfo);void CJCJView:OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)/ TODO: add extra initialization before printingvoid CJCJView:OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)/ TODO: add cleanup after printing/ CJCJView diagnostics#ifdef _DEBUGvoid CJCJView:AssertValid() constCView:AssertValid();void CJCJView:Dump(CDumpContext& dc) constCView:Dump(dc);CJCJDoc* CJCJView:GetDocument() / non-debug version is inlineASSERT(m_pDocument-IsKindOf(RUNTIME_CLASS(CJCJDoc);return (CJCJDoc*)m_pDocument;#endif /_DEBUG/ CJCJView message handlersvoid CJCJView:OnMenuitem32771() CWnd *pParent=GetParent();/得到主框窗口CMenu *pMenu=pParent-GetMenu ();/得到所有菜单 CMenu *SubMenu1=pMenu-GetSubMenu(4);/第5列菜单CMenu menu;menu.CreatePopupMenu();switch (m)case 1:SubMenu1-AppendMenu(MF_STRING,caidanID,menu1);caidanID+;m+;break;case 2:SubMenu1-AppendMenu(MF_STRING,caidanID,menu2);caidanID+;m+;break;case 3:SubMenu1-AppendMenu(MF_STRING,caidanID,menu3);caidanID+;m+;break;default:MessageBox(添加完!);menu.Detach();GetParent()-DrawMenuBar();void CJCJView:OnMenuitem32772() CDC *pDC;pDC=GetDC();CRect rect(100,100,300,300); /画一个长100,宽100的矩形pDC-Rectangle(&rect);void CJCJView:OnMenuitem32773() /MessageBox(车辆22222222);CDC *pDC;pDC=GetDC();CPoint poly4; /画一个平行四边形poly0=CPoint(0,0);poly1=CPoint(50,50);poly2=CPoint(50,100);poly3=CPoint(0,50);pDC-Polygon(poly,4);void CJCJView:OnMenuitem32774() MessageBox(车辆33333333);void CJCJView:OnMouseMove(UINT nFlags, CPoint point) CMainFrame *pm=(CMainFrame *)AfxGetMainWnd();CStatusBar *psb=&pm-m_wndStatusBar;CString str;if(psb)str.Format(x=%d,y=%d,point.x,point.y);psb-SetPaneText(0,str);/psb-SetPaneText(psb-CommandToIndex(ID_SEPARATOR), str);CView:OnMouseMove(nFlags, point);void CJCJView:OnTimer(UINT nIDEvent) if(x_b=1000|x_b=0)flag=!flag;if (flag=1) x_b=x_b+1; elsex_b=x_b-1; UpdateData(true);CBitmap bitmap1,*pOldbitmap;bitmap1.LoadBitmap(IDB_BITMAP1);CDC memDC1,*pDC;pDC=GetDC();memDC1.CreateCompatibleDC(pDC);pOldbitmap=memDC1.SelectObject(&bitmap1); pDC-BitBlt(x_b, 0, 600, 600, &memDC1, 0, 0, SRCCOPY);if(flag=1) pDC-FillSolidRect(0, 0, x_b, 600,RGB(255,255,255); else pDC-FillSolidRect(x_b+300, 0, 1200,600,RGB(255,255,255); memDC1.SelectObject(pOldbitmap);CView:OnTimer(nIDEvent);void CJCJView:OnMENUbitmap() SetTimer(0,10,NULL);void CJCJView:text(CDC *pDC,int x_zuobiao,int y_zuobiao,int Da_ziti, LPCTSTR ziti, COLORREF r_color,CString str )CFont fn;CFont *pfn;fn.CreatePointFont(Da_ziti,ziti,pDC);pfn=pDC-SelectObject(&fn);pDC-SetTextColor(r_color);pDC-TextOut(x_zuobiao,y_zuobiao,str);pDC-SelectObject(pfn);void CJCJView:OnMENUtextout() CDC *pDC;pDC=GetDC();CFont fn1;CFont *pfn1;fn1.CreatePointFont(200,Arial,pDC);pfn1=pDC-SelectObject(&fn1);pDC-SetTextColor(RGB(0,125,0);pDC-TextOut(20,300,1234567890);pDC-SelectObject(pfn1);void CJCJView:OnMENUdraw() CDC *pDC;pDC=GetDC();CPoint poly4; /画一个平行四边形poly0=CPoint(0,0);poly1=CPoint(50,50);poly2=CPoint(50,100);poly3=CPoint(0,50);pDC-Polygon(poly,4);CRect rect(100,100,300,300); /画一个长100,宽100的矩形pDC-Rectangle(&rect);MainFrm.cpp/ MainFrm.cpp : implementation of the CMainFrame class/#include stdafx.h#include JCJ.h#include MainFrm.h#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE = _FILE_;#endif/ CMainFrameIMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)/AFX_MSG_MAP(CMainFrame)ON_WM_CREATE()ON_WM_TIMER()ON_WM_CLOSE()/AFX_MSG_MAPEND_MESSAGE_MAP()static UINT indicators =ID_SEPARATOR, / status line indicatorID_INDICATOR_CAPS,ID_INDICATOR_NUM,ID_INDICATOR_SCRL, ID_INDICATOR_TIMER,;/ CMainFrame construction/destructionCMainFrame:CMainFrame()/ TODO: add member initialization code hereCMainFrame:CMainFrame()int CMainFrame:OnCreate(LPCREATESTRUCT lpCreateStruct)if (CFrameWnd:OnCreate(lpCreateStruct) = -1)return -1;if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) |!m_wndToolBar.LoadToolBar(IDR_MAINFRAME)TRACE0(Failed to create toolbarn);return -1; / fail to createif (!m_wndStatusBar.Create(this) |!m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)TRACE0(Failed to create status barn);return -1; / fail to create/ TODO: Delete these three lines if you dont want the toolbar to/ be dockablem_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);EnableDocking(CBRS_ALIGN_ANY);DockControlBar(&m_wndToolBar);SetTimer(1,1000,NULL);/安装一个计时器return 0;BOOL CMainFrame:PreCreateWindow(CREATESTRUCT& cs)if( !CFrameWnd:PreCreateWindow(cs) )return FALSE;/ TODO: Modify the Window class or styles here b
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 石头城刘禹锡教学课件
- 二手车拍卖合同
- 居家办公贷款合同
- 2025年婚后共同资产权益协议合同
- 2025年专利申请知识产权许可合同范本
- 教学课件第一批
- 周末兴趣班学生安全合同
- 2025年汽车产权互换协议样式
- 每逢佳节倍思亲课件
- 小学实验教学说课课件
- 人教版(2025新版)七年级下册数学第七章 相交线与平行线 单元测试卷(含答案)
- 厂房消防应急预案
- 景区开发政府战略框架协议书(2篇)
- 保洁投标书范本
- “雄鹰杯”全国小动物医师技能大赛考试题库(660题)
- 实验室隐患排查培训
- 九年级化学第三单元课题1分子和原子人教新课标版省公开课获奖课件说课比赛一等奖课件
- 宠物医疗器械创新与发展
- 《路由与交换技术》教学大纲
- 4《给植物画张“像”》教学设计-2024-2025学年科学一年级上册教科版
- 森林防火条例
评论
0/150
提交评论