[!if RIBBON_TOOLBAR] // 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面 // (“Fluent UI”)。该示例仅供参考, // 用以补充《Microsoft 基础类参考》和 // MFC C++ 库软件随附的相关电子文档。 // 复制、使用或分发 Fluent UI 的许可条款是单独提供的。 // 若要了解有关 Fluent UI 许可计划的详细信息,请访问 // https://go.microsoft.com/fwlink/?LinkId=238214. // // 版权所有(C) Microsoft Corporation // 保留所有权利。 [!endif] // $treeviewimpl$: $treeviewclass$ 类的实现 // #include "pch.h" #include "framework.h" #include "$appheader$" #include "$docheader$" #include "$treeviewheader$" #ifdef _DEBUG #define new DEBUG_NEW #endif // $treeviewclass$ IMPLEMENT_DYNCREATE($treeviewclass$, $treeviewbaseclass$) BEGIN_MESSAGE_MAP($treeviewclass$, $treeviewbaseclass$) [!if PRINTING] // 标准打印命令 ON_COMMAND(ID_FILE_PRINT, &$treeviewbaseclass$::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_DIRECT, &$treeviewbaseclass$::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_PREVIEW, &$treeviewbaseclass$::OnFilePrintPreview) [!endif] END_MESSAGE_MAP() // $treeviewclass$ 构造/析构 $treeviewclass$::$treeviewclass$() { [!if ACCESSIBILITY] EnableActiveAccessibility(); [!endif] // TODO: 在此处添加构造代码 } $treeviewclass$::~$treeviewclass$() { } BOOL $treeviewclass$::PreCreateWindow(CREATESTRUCT& cs) { // TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或样式 return $treeviewbaseclass$::PreCreateWindow(cs); } [!if PRINTING] // $treeviewclass$ 打印 BOOL $treeviewclass$::OnPreparePrinting(CPrintInfo* pInfo) { // 默认准备 return DoPreparePrinting(pInfo); } void $treeviewclass$::OnDraw(CDC* /*pDC*/) { $docclass$* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: 在此处为本机数据添加绘制代码 } void $treeviewclass$::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: 添加额外的打印前进行的初始化过程 } void $treeviewclass$::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: 添加打印后进行的清理过程 } [!endif] void $treeviewclass$::OnInitialUpdate() { $treeviewbaseclass$::OnInitialUpdate(); // TODO: 调用 GetTreeCtrl() 直接访问 TreeView 的树控件, // 从而可以用项填充 TreeView。 } // $treeviewclass$ 诊断 #ifdef _DEBUG void $treeviewclass$::AssertValid() const { $treeviewbaseclass$::AssertValid(); } void $treeviewclass$::Dump(CDumpContext& dc) const { $treeviewbaseclass$::Dump(dc); } $docclass$* $treeviewclass$::GetDocument() // 非调试版本是内联的 { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS($docclass$))); return ($docclass$*)m_pDocument; } #endif //_DEBUG // $treeviewclass$ 消息处理程序