toolbar2View.cpp
资源名称:toolbar2.rar [点击查看]
上传用户:polygal
上传日期:2021-02-10
资源大小:1938k
文件大小:3k
源码类别:
工具条
开发平台:
Visual C++
- // toolbar2View.cpp : implementation of the CToolbar2View class
- //
- #include "stdafx.h"
- #include "toolbar2.h"
- #include "toolbar2Doc.h"
- #include "toolbar2View.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CToolbar2View
- IMPLEMENT_DYNCREATE(CToolbar2View, CView)
- BEGIN_MESSAGE_MAP(CToolbar2View, CView)
- //{{AFX_MSG_MAP(CToolbar2View)
- ON_COMMAND(IDC_MSG1, OnMsg1)
- ON_COMMAND(IDC_MSG2, OnMsg2)
- ON_COMMAND(IDC_MSG3, OnMsg3)
- //}}AFX_MSG_MAP
- // Standard printing commands
- 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()
- /////////////////////////////////////////////////////////////////////////////
- // CToolbar2View construction/destruction
- CToolbar2View::CToolbar2View()
- {
- // TODO: add construction code here
- }
- CToolbar2View::~CToolbar2View()
- {
- }
- BOOL CToolbar2View::PreCreateWindow(CREATESTRUCT& cs)
- {
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return CView::PreCreateWindow(cs);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CToolbar2View drawing
- void CToolbar2View::OnDraw(CDC* pDC)
- {
- CToolbar2Doc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
- // TODO: add draw code for native data here
- }
- /////////////////////////////////////////////////////////////////////////////
- // CToolbar2View printing
- BOOL CToolbar2View::OnPreparePrinting(CPrintInfo* pInfo)
- {
- // default preparation
- return DoPreparePrinting(pInfo);
- }
- void CToolbar2View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add extra initialization before printing
- }
- void CToolbar2View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
- {
- // TODO: add cleanup after printing
- }
- /////////////////////////////////////////////////////////////////////////////
- // CToolbar2View diagnostics
- #ifdef _DEBUG
- void CToolbar2View::AssertValid() const
- {
- CView::AssertValid();
- }
- void CToolbar2View::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
- CToolbar2Doc* CToolbar2View::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CToolbar2Doc)));
- return (CToolbar2Doc*)m_pDocument;
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CToolbar2View message handlers
- void CToolbar2View::OnMsg1()
- {
- // TODO: Add your command handler code here
- CClientDC dc(this);
- dc.TextOut(100,100,"messages one .please select menus to change message!,waiting!");
- }
- void CToolbar2View::OnMsg2()
- {
- // TODO: Add your command handler code here
- Invalidate();
- CClientDC dc(this);
- MessageBox("天天见到你!");
- }
- void CToolbar2View::OnMsg3()
- {
- // TODO: Add your command handler code here
- Invalidate();
- RECT rect;
- CPaintDC dc(this);
- CDC *md=new CDC;
- CBitmap *bitmap=new CBitmap;
- GetClientRect(&rect);
- md->CreateCompatibleDC(&dc);
- bitmap->m_hObject=(HBITMAP)::LoadImage(NULL,"c30.bmp",IMAGE_BITMAP,rect.right,rect.bottom,LR_LOADFROMFILE);
- md->SelectObject(bitmap);
- dc.BitBlt(0,0,rect.right,rect.bottom,md,0,0,SRCCOPY);
- delete md;
- delete bitmap;
- }