VC程序源代码贾长建.docx

上传人:b****5 文档编号:2941628 上传时间:2022-11-16 格式:DOCX 页数:11 大小:17.04KB
下载 相关 举报
VC程序源代码贾长建.docx_第1页
第1页 / 共11页
VC程序源代码贾长建.docx_第2页
第2页 / 共11页
VC程序源代码贾长建.docx_第3页
第3页 / 共11页
VC程序源代码贾长建.docx_第4页
第4页 / 共11页
VC程序源代码贾长建.docx_第5页
第5页 / 共11页
点击查看更多>>
下载资源
资源描述

VC程序源代码贾长建.docx

《VC程序源代码贾长建.docx》由会员分享,可在线阅读,更多相关《VC程序源代码贾长建.docx(11页珍藏版)》请在冰豆网上搜索。

VC程序源代码贾长建.docx

VC程序源代码贾长建

JCJView.cpp

//JCJView.cpp:

implementationoftheCJCJViewclass

//

#include"stdafx.h"

#include"JCJ.h"

#include"JCJDoc.h"

#include"JCJView.h"

#include"MainFrm.h"

#ifdef_DEBUG

#definenewDEBUG_NEW

#undefTHIS_FILE

staticcharTHIS_FILE[]=__FILE__;

#endif

/////////////////////////////////////////////////////////////////////////////

//CJCJView

IMPLEMENT_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

//Standardprintingcommands

ON_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()

/////////////////////////////////////////////////////////////////////////////

//CJCJViewconstruction/destruction

CJCJView:

:

CJCJView()

{x_b=0;flag=0;

caidanID=32772,m=1;

}

CJCJView:

:

~CJCJView()

{

}

BOOLCJCJView:

:

PreCreateWindow(CREATESTRUCT&cs)

{

//TODO:

ModifytheWindowclassorstylesherebymodifying

//theCREATESTRUCTcs

returnCView:

:

PreCreateWindow(cs);

}

/////////////////////////////////////////////////////////////////////////////

//CJCJViewdrawing

voidCJCJView:

:

OnDraw(CDC*pDC)

{text(pDC,200,300,200,"黑体",RGB(0,0,255),"1232222222222");

CJCJDoc*pDoc=GetDocument();

ASSERT_VALID(pDoc);

//TODO:

adddrawcodefornativedatahere

}

/////////////////////////////////////////////////////////////////////////////

//CJCJViewprinting

BOOLCJCJView:

:

OnPreparePrinting(CPrintInfo*pInfo)

{

//defaultpreparation

returnDoPreparePrinting(pInfo);

}

voidCJCJView:

:

OnBeginPrinting(CDC*/*pDC*/,CPrintInfo*/*pInfo*/)

{

//TODO:

addextrainitializationbeforeprinting

}

voidCJCJView:

:

OnEndPrinting(CDC*/*pDC*/,CPrintInfo*/*pInfo*/)

{

//TODO:

addcleanupafterprinting

}

/////////////////////////////////////////////////////////////////////////////

//CJCJViewdiagnostics

#ifdef_DEBUG

voidCJCJView:

:

AssertValid()const

{

CView:

:

AssertValid();

}

voidCJCJView:

:

Dump(CDumpContext&dc)const

{

CView:

:

Dump(dc);

}

CJCJDoc*CJCJView:

:

GetDocument()//non-debugversionisinline

{

ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CJCJDoc)));

return(CJCJDoc*)m_pDocument;

}

#endif//_DEBUG

/////////////////////////////////////////////////////////////////////////////

//CJCJViewmessagehandlers

voidCJCJView:

:

OnMenuitem32771()

{

CWnd*pParent=GetParent();//得到主框窗口

CMenu*pMenu=pParent->GetMenu();//得到所有菜单

CMenu*SubMenu1=pMenu->GetSubMenu(4);//第5列菜单

CMenumenu;

menu.CreatePopupMenu();

switch(m)

{

case1:

SubMenu1->AppendMenu(MF_STRING,caidanID,"menu1");caidanID++;m++;break;

case2:

SubMenu1->AppendMenu(MF_STRING,caidanID,"menu2");caidanID++;m++;break;

case3:

SubMenu1->AppendMenu(MF_STRING,caidanID,"menu3");caidanID++;m++;break;

default:

MessageBox("添加完!

");

}

menu.Detach();

GetParent()->DrawMenuBar();

}

voidCJCJView:

:

OnMenuitem32772()

{

CDC*pDC;

pDC=GetDC();

CRectrect(100,100,300,300);//画一个长100,宽100的矩形

pDC->Rectangle(&rect);

}

voidCJCJView:

:

OnMenuitem32773()

{

//MessageBox("车辆22222222");

CDC*pDC;

pDC=GetDC();

CPointpoly[4];//画一个平行四边形

poly[0]=CPoint(0,0);

poly[1]=CPoint(50,50);

poly[2]=CPoint(50,100);

poly[3]=CPoint(0,50);

pDC->Polygon(poly,4);

}

voidCJCJView:

:

OnMenuitem32774()

{

MessageBox("车辆33333333");

}

voidCJCJView:

:

OnMouseMove(UINTnFlags,CPointpoint)

{

CMainFrame*pm=(CMainFrame*)AfxGetMainWnd();

CStatusBar*psb=&pm->m_wndStatusBar;

CStringstr;

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);

}

voidCJCJView:

:

OnTimer(UINTnIDEvent)

{

if(x_b==1000||x_b==0)

flag=!

flag;

if(flag==1)

{x_b=x_b+1;}

else

{x_b=x_b-1;}

UpdateData(true);

CBitmapbitmap1,*pOldbitmap;

bitmap1.LoadBitmap(IDB_BITMAP1);

CDCmemDC1,*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);

}

voidCJCJView:

:

OnMENUbitmap()

{

SetTimer(0,10,NULL);

}

voidCJCJView:

:

text(CDC*pDC,intx_zuobiao,inty_zuobiao,intDa_ziti,LPCTSTRziti,COLORREFr_color,CStringstr

{

CFontfn;

CFont*pfn;

fn.CreatePointFont(Da_ziti,ziti,pDC);

pfn=pDC->SelectObject(&

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 工作计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1