📄 pcdmview.cpp
字号:
// PCDMView.cpp : implementation of the CPCDMView class
//
#include "stdafx.h"
#include "PCDM.h"
#include "PCDMDoc.h"
#include "PCDMView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPCDMView
IMPLEMENT_DYNCREATE(CPCDMView, CFormView)
BEGIN_MESSAGE_MAP(CPCDMView, CFormView)
//{{AFX_MSG_MAP(CPCDMView)
// 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
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPCDMView construction/destruction
CPCDMView::CPCDMView()
: CFormView(CPCDMView::IDD) // <BOOK_ADDON Step2 Chapter 7.1.4/> **********
{
// TODO: add construction code here
}
CPCDMView::~CPCDMView()
{
}
BOOL CPCDMView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFormView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CPCDMView drawing
void CPCDMView::OnDraw(CDC* pDC)
{
CPCDMDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CPCDMView diagnostics
#ifdef _DEBUG
void CPCDMView::AssertValid() const
{
CFormView::AssertValid();
}
void CPCDMView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
CPCDMDoc* CPCDMView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPCDMDoc)));
return (CPCDMDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CPCDMView message handlers
// <BOOK_ADDON Step2 Chapter 7.1.4> **********************************************
void CPCDMView::DoDataExchange(CDataExchange* pDX)
{
// TODO: Add your specialized code here and/or call the base class
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPCDMView)
DDX_Control(pDX, IDC_COMMANDER, m_cmdBar);
//}}AFX_DATA_MAP
}
BEGIN_EVENTSINK_MAP(CPCDMView, CFormView)
//{{AFX_EVENTSINK_MAP(CPCDMView)
ON_EVENT(CPCDMView, IDC_COMMANDER, 1 /* CmdBarAction */, OnCmdBarActionCommander, VTS_I4 VTS_BSTR)
//}}AFX_EVENTSINK_MAP
END_EVENTSINK_MAP()
void CPCDMView::OnCmdBarActionCommander(long ID, LPCTSTR text)
{
if (ID==IDCLOSE)
GetParentFrame()->DestroyWindow();
}
void CPCDMView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// Sizes the IDD_MAINFORM Dialog to the size of the Mainframe
CRect myRect;
GetParentFrame()->GetClientRect(&myRect);
SetWindowPos(NULL,myRect.left,myRect.top,
myRect.right,myRect.bottom,SWP_NOZORDER);
m_cmdBar.SetWindowPos(NULL,myRect.top,myRect.left,
myRect.right,25,SWP_NOZORDER);
// Creates our Command-Bar
//<BOOK_ADDON STEP3 Chapter 7.2.4> *********************************
m_cmdBar.SetCmdBarType(1);
m_cmdBar.CreateBar(1,0);
//</BOOK_ADDON STEP3 Chapter 7.2.4> *********************************
// Inserts Menus
m_cmdBar.InsertMenu(TEXT("File"),0);
m_cmdBar.InsertMenuItem(TEXT("Send to..") ,0,0,30);
m_cmdBar.InsertMenuItem(TEXT("Receive..") ,0,1,36);
m_cmdBar.InsertMenuItem(TEXT("Show Details"),0,2,31);
m_cmdBar.InsertMenuItem(TEXT("") ,0,3,0);
m_cmdBar.InsertMenuItem(TEXT("Help") ,0,4,34);
m_cmdBar.InsertMenuItem(TEXT("About") ,0,5,35);
m_cmdBar.InsertMenuItem(TEXT("") ,0,6,0);
m_cmdBar.InsertMenuItem(TEXT("Exit") ,0,7,IDCLOSE);
//<BOOK_ADDON STEP3 Chapter 7.2.4> *********************************
m_cmdBar.CreateBar(101,RBBS_FIXEDBMP);
m_cmdBar.InsertButton(SBM_SEP,TBSTATE_ENABLED, 0,0, TEXT(""));
//</BOOK_ADDON STEP3 Chapter 7.2.4> *********************************
// Inserts Toolbar Buttons
m_cmdBar.InsertButton(SBM_SEND,TBSTATE_ENABLED, 1,30,
TEXT("Send Entry to other Device"));
m_cmdBar.InsertButton(SBM_OPEN,TBSTATE_ENABLED, 2,31,
TEXT("Show Details"));
m_cmdBar.InsertButton(SBM_SEP,TBSTATE_ENABLED, 3,0,
TEXT(""));
m_cmdBar.InsertButton(SBM_FIND,TBSTATE_ENABLED, 4,32,
TEXT("Search for CD"));
m_cmdBar.InsertButton(SBM_SEP,TBSTATE_ENABLED, 5,0,
TEXT(""));
m_cmdBar.InsertButton(SBM_HELP,TBSTATE_ENABLED,6,34,
TEXT("Help"));
m_cmdBar.InsertButton(SBM_PROP,TBSTATE_ENABLED,7,35,
TEXT("About"));
// Inserts the Search Combo Box
m_cmdBar.InsertComboBox(100,4,1007);
m_cmdBar.AddStringToComboBox(1007,TEXT("Madonna"));
//</BOOK_ADDON STEP3 Chapter 7.2.4> *********************************
// Adds the Close Button
m_cmdBar.SetAdornments(0);
}
// </BOOK_ADDON Step2 Chapter 7.1.4> **********************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -