⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dlgbarview.cpp

📁 这是书上的代码
💻 CPP
字号:
// DlgBarView.cpp : implementation of the CDlgBarView class
//
#include "stdafx.h"
#include "DlgBar.h"

#include "DlgBarDoc.h"
#include "DlgBarView.h"
#include "MainFrm.h"    //必须位于前两头文件之后

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDlgBarView

IMPLEMENT_DYNCREATE(CDlgBarView, CView)

BEGIN_MESSAGE_MAP(CDlgBarView, CView)
	//{{AFX_MSG_MAP(CDlgBarView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}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)
	ON_EN_CHANGE(IDC_EDIT1,OnChangeDlgEdit)
	ON_LBN_SELCHANGE(IDC_COMBO1,OnChanngeDlgCom)
	ON_BN_CLICKED(IDC_BUTTON1,OnButton)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgBarView construction/destruction

CDlgBarView::CDlgBarView()
{
	// TODO: add construction code here

}

CDlgBarView::~CDlgBarView()
{
}

BOOL CDlgBarView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CDlgBarView drawing

void CDlgBarView::OnDraw(CDC* pDC)
{
	CDlgBarDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CDlgBarView printing

BOOL CDlgBarView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CDlgBarView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CDlgBarView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CDlgBarView diagnostics

#ifdef _DEBUG
void CDlgBarView::AssertValid() const
{
	CView::AssertValid();
}

void CDlgBarView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CDlgBarDoc* CDlgBarView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDlgBarDoc)));
	return (CDlgBarDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CDlgBarView message handlers

void CDlgBarView::OnChangeDlgEdit()
{
   AfxMessageBox("编辑内容改变");
}

void CDlgBarView::OnChanngeDlgCom()
{  CString ss;
   CMainFrame *p_Wnd=(CMainFrame *)(AfxGetApp()->m_pMainWnd);
   CComboBox *p_com=(CComboBox *)p_Wnd->m_wndDlgBar.GetDlgItem(IDC_COMBO1);
   p_com->GetLBText(p_com->GetCurSel(),ss);
   AfxMessageBox(ss);

}

void CDlgBarView::OnButton()
{  CClientDC dc(this);
   dc.TextOut(100,100,"按下按钮");
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -