first Commint

master
liuwanqiang 2023-10-29 18:28:41 +08:00
parent b8f4108df0
commit 09e3207620
42 changed files with 1782 additions and 0 deletions

BIN
Debug/MFCSpiltSDI.exe Normal file

Binary file not shown.

BIN
Debug/MFCSpiltSDI.ilk Normal file

Binary file not shown.

BIN
Debug/MFCSpiltSDI.pdb Normal file

Binary file not shown.

31
MFCSpiltSDI.sln Normal file
View File

@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.852
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MFCSpiltSDI", "MFCSpiltSDI\MFCSpiltSDI.vcxproj", "{EF4135F2-CD96-442B-A047-DEB59E78C64D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EF4135F2-CD96-442B-A047-DEB59E78C64D}.Debug|x64.ActiveCfg = Debug|x64
{EF4135F2-CD96-442B-A047-DEB59E78C64D}.Debug|x64.Build.0 = Debug|x64
{EF4135F2-CD96-442B-A047-DEB59E78C64D}.Debug|x86.ActiveCfg = Debug|Win32
{EF4135F2-CD96-442B-A047-DEB59E78C64D}.Debug|x86.Build.0 = Debug|Win32
{EF4135F2-CD96-442B-A047-DEB59E78C64D}.Release|x64.ActiveCfg = Release|x64
{EF4135F2-CD96-442B-A047-DEB59E78C64D}.Release|x64.Build.0 = Release|x64
{EF4135F2-CD96-442B-A047-DEB59E78C64D}.Release|x86.ActiveCfg = Release|Win32
{EF4135F2-CD96-442B-A047-DEB59E78C64D}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {81419724-B5CD-4782-937D-07FB26FC3B7D}
EndGlobalSection
EndGlobal

67
MFCSpiltSDI/FormLeft.cpp Normal file
View File

@ -0,0 +1,67 @@
// FormLeft.cpp : 实现文件
//
#include "stdafx.h"
#include "MFCSpiltSDI.h"
#include "FormLeft.h"
// CFormLeft
IMPLEMENT_DYNCREATE(CFormLeft, CFormView)
CFormLeft::CFormLeft()
: CFormView(CFormLeft::IDD)
, m_target(NULL)
{
}
CFormLeft::~CFormLeft()
{
}
void CFormLeft::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CFormLeft, CFormView)
END_MESSAGE_MAP()
// CFormLeft 诊断
#ifdef _DEBUG
void CFormLeft::AssertValid() const
{
CFormView::AssertValid();
}
#ifndef _WIN32_WCE
void CFormLeft::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif
#endif //_DEBUG
// CFormLeft 消息处理程序
// 将消息从该表单发送到我们设置的目标窗口
BOOL CFormLeft::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: 在此添加专用代码和/或调用基类
if (m_target)
m_target->SendMessage(WM_COMMAND, wParam, lParam);
else
CFormView::OnCommand(wParam, lParam);
return CFormView::OnCommand(wParam, lParam);
}
void CFormLeft::SetTarget(CWnd* m_cwnd)
{
m_target = m_cwnd;
}

32
MFCSpiltSDI/FormLeft.h Normal file
View File

@ -0,0 +1,32 @@
#pragma once
// CFormLeft 窗体视图
class CFormLeft : public CFormView
{
DECLARE_DYNCREATE(CFormLeft)
public:
CFormLeft(); // 动态创建所使用的受保护的构造函数
virtual ~CFormLeft();
public:
enum { IDD = IDD_FORM_LEFT };
#ifdef _DEBUG
virtual void AssertValid() const;
#ifndef _WIN32_WCE
virtual void Dump(CDumpContext& dc) const;
#endif
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
CWnd* m_target;
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
public:
void SetTarget(CWnd* m_cwnd);
};

55
MFCSpiltSDI/FormRight.cpp Normal file
View File

@ -0,0 +1,55 @@
// FormRight.cpp : 实现文件
//
#include "stdafx.h"
#include "MFCSpiltSDI.h"
#include "FormRight.h"
// CFormRight
IMPLEMENT_DYNCREATE(CFormRight, CFormView)
CFormRight::CFormRight()
: CFormView(CFormRight::IDD)
{
}
CFormRight::~CFormRight()
{
}
void CFormRight::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CFormRight, CFormView)
END_MESSAGE_MAP()
// CFormRight 诊断
#ifdef _DEBUG
void CFormRight::AssertValid() const
{
CFormView::AssertValid();
}
#ifndef _WIN32_WCE
void CFormRight::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif
#endif //_DEBUG
void CFormRight::OnBnClickedButtonHello()
{
// TODO: 在此添加控件通知处理程序代码
}

34
MFCSpiltSDI/FormRight.h Normal file
View File

@ -0,0 +1,34 @@
#pragma once
#include "afxwin.h"
// CFormRight 窗体视图
class CFormRight : public CFormView
{
DECLARE_DYNCREATE(CFormRight)
protected:
CFormRight(); // 动态创建所使用的受保护的构造函数
virtual ~CFormRight();
public:
enum { IDD = IDD_FORM_RIGHT };
#ifdef _DEBUG
virtual void AssertValid() const;
#ifndef _WIN32_WCE
virtual void Dump(CDumpContext& dc) const;
#endif
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedButtonHello();
};

BIN
MFCSpiltSDI/MFCSpiltSDI.aps Normal file

Binary file not shown.

221
MFCSpiltSDI/MFCSpiltSDI.cpp Normal file
View File

@ -0,0 +1,221 @@
// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
// (“Fluent UI”)。该示例仅供参考,
// 用以补充《Microsoft 基础类参考》和
// MFC C++ 库软件随附的相关电子文档。
// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
// 若要了解有关 Fluent UI 许可计划的详细信息,请访问
// https://go.microsoft.com/fwlink/?LinkId=238214.
//
// 版权所有(C) Microsoft Corporation
// 保留所有权利。
// MFCSpiltSDI.cpp: 定义应用程序的类行为。
//
#include "stdafx.h"
#include "afxwinappex.h"
#include "afxdialogex.h"
#include "MFCSpiltSDI.h"
#include "MainFrm.h"
#include "MFCSpiltSDIDoc.h"
#include "MFCSpiltSDIView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMFCSpiltSDIApp
BEGIN_MESSAGE_MAP(CMFCSpiltSDIApp, CWinAppEx)
ON_COMMAND(ID_APP_ABOUT, &CMFCSpiltSDIApp::OnAppAbout)
// 基于文件的标准文档命令
ON_COMMAND(ID_FILE_NEW, &CWinAppEx::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, &CWinAppEx::OnFileOpen)
// 标准打印设置命令
ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinAppEx::OnFilePrintSetup)
END_MESSAGE_MAP()
// CMFCSpiltSDIApp 构造
CMFCSpiltSDIApp::CMFCSpiltSDIApp() noexcept
{
// 支持重新启动管理器
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_ALL_ASPECTS;
#ifdef _MANAGED
// 如果应用程序是利用公共语言运行时支持(/clr)构建的,则:
// 1) 必须有此附加设置,“重新启动管理器”支持才能正常工作。
// 2) 在您的项目中,您必须按照生成顺序向 System.Windows.Forms 添加引用。
System::Windows::Forms::Application::SetUnhandledExceptionMode(System::Windows::Forms::UnhandledExceptionMode::ThrowException);
#endif
// TODO: 将以下应用程序 ID 字符串替换为唯一的 ID 字符串;建议的字符串格式
//为 CompanyName.ProductName.SubProduct.VersionInformation
SetAppID(_T("MFCSpiltSDI.AppID.NoVersion"));
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}
// 唯一的 CMFCSpiltSDIApp 对象
CMFCSpiltSDIApp theApp;
// CMFCSpiltSDIApp 初始化
BOOL CMFCSpiltSDIApp::InitInstance()
{
// 如果一个运行在 Windows XP 上的应用程序清单指定要
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
//则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// 将它设置为包括所有要在应用程序中使用的
// 公共控件类。
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinAppEx::InitInstance();
// 初始化 OLE 库
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
EnableTaskbarInteraction(FALSE);
// 使用 RichEdit 控件需要 AfxInitRichEdit2()
// AfxInitRichEdit2();
// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
LoadStdProfileSettings(4); // 加载标准 INI 文件选项(包括 MRU)
InitContextMenuManager();
InitKeyboardManager();
InitTooltipManager();
CMFCToolTipInfo ttParams;
ttParams.m_bVislManagerTheme = TRUE;
theApp.GetTooltipManager()->SetTooltipParams(AFX_TOOLTIP_TYPE_ALL,
RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
// 注册应用程序的文档模板。 文档模板
// 将用作文档、框架窗口和视图之间的连接
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMFCSpiltSDIDoc),
RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口
RUNTIME_CLASS(CMFCSpiltSDIView));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
// 分析标准 shell 命令、DDE、打开文件操作的命令行
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// 调度在命令行中指定的命令。 如果
// 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// 唯一的一个窗口已初始化,因此显示它并对其进行更新
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
int CMFCSpiltSDIApp::ExitInstance()
{
//TODO: 处理可能已添加的附加资源
AfxOleTerm(FALSE);
return CWinAppEx::ExitInstance();
}
// CMFCSpiltSDIApp 消息处理程序
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg() noexcept;
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_ABOUTBOX };
#endif
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() noexcept : CDialogEx(IDD_ABOUTBOX)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()
// 用于运行对话框的应用程序命令
void CMFCSpiltSDIApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
// CMFCSpiltSDIApp 自定义加载/保存方法
void CMFCSpiltSDIApp::PreLoadState()
{
BOOL bNameValid;
CString strName;
bNameValid = strName.LoadString(IDS_EDIT_MENU);
ASSERT(bNameValid);
GetContextMenuManager()->AddMenu(strName, IDR_POPUP_EDIT);
}
void CMFCSpiltSDIApp::LoadCustomState()
{
}
void CMFCSpiltSDIApp::SaveCustomState()
{
}
// CMFCSpiltSDIApp 消息处理程序

48
MFCSpiltSDI/MFCSpiltSDI.h Normal file
View File

@ -0,0 +1,48 @@
// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
// (“Fluent UI”)。该示例仅供参考,
// 用以补充《Microsoft 基础类参考》和
// MFC C++ 库软件随附的相关电子文档。
// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
// 若要了解有关 Fluent UI 许可计划的详细信息,请访问
// https://go.microsoft.com/fwlink/?LinkId=238214.
//
// 版权所有(C) Microsoft Corporation
// 保留所有权利。
// MFCSpiltSDI.h: MFCSpiltSDI 应用程序的主头文件
//
#pragma once
#ifndef __AFXWIN_H__
#error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件"
#endif
#include "resource.h" // 主符号
// CMFCSpiltSDIApp:
// 有关此类的实现,请参阅 MFCSpiltSDI.cpp
//
class CMFCSpiltSDIApp : public CWinAppEx
{
public:
CMFCSpiltSDIApp() noexcept;
// 重写
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
// 实现
UINT m_nAppLook;
virtual void PreLoadState();
virtual void LoadCustomState();
virtual void SaveCustomState();
afx_msg void OnAppAbout();
DECLARE_MESSAGE_MAP()
};
extern CMFCSpiltSDIApp theApp;

BIN
MFCSpiltSDI/MFCSpiltSDI.rc Normal file

Binary file not shown.

BIN
MFCSpiltSDI/MFCSpiltSDI.sdf Normal file

Binary file not shown.

BIN
MFCSpiltSDI/MFCSpiltSDI.suo Normal file

Binary file not shown.

View File

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{EF4135F2-CD96-442B-A047-DEB59E78C64D}</ProjectGuid>
<Keyword>MFCProj</Keyword>
<RootNamespace>MFCSpiltSDI</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="FormLeft.h" />
<ClInclude Include="FormRight.h" />
<ClInclude Include="MainFrm.h" />
<ClInclude Include="MFCSpiltSDI.h" />
<ClInclude Include="MFCSpiltSDIDoc.h" />
<ClInclude Include="MFCSpiltSDIView.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="FormRight.cpp" />
<ClCompile Include="FormLeft.cpp" />
<ClCompile Include="MainFrm.cpp" />
<ClCompile Include="MFCSpiltSDI.cpp" />
<ClCompile Include="MFCSpiltSDIDoc.cpp" />
<ClCompile Include="MFCSpiltSDIView.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MFCSpiltSDI.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="res\author.bmp" />
<Image Include="res\buttons.bmp" />
<Image Include="res\Damogu.ico" />
<Image Include="res\filelarge.bmp" />
<Image Include="res\filesmall.bmp" />
<Image Include="res\main.bmp" />
<Image Include="res\MENU.bmp" />
<Image Include="res\MFCSpiltSDI.ico" />
<Image Include="res\MFCSpiltSDIDoc.ico" />
<Image Include="res\pcan.bmp" />
<Image Include="res\Toolbar.bmp" />
<Image Include="res\Toolbar256.bmp" />
<Image Include="res\writelarge.bmp" />
<Image Include="res\writesmall.bmp" />
</ItemGroup>
<ItemGroup>
<None Include="res\MFCSpiltSDI.rc2" />
<None Include="res\ribbon.mfcribbon-ms" />
<None Include="res\ribbon1.mfcribbon-ms" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="MFCSpiltSDI.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MainFrm.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MFCSpiltSDIDoc.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="MFCSpiltSDIView.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FormLeft.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FormRight.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="MFCSpiltSDI.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="MainFrm.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="MFCSpiltSDIDoc.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="MFCSpiltSDIView.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FormLeft.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FormRight.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MFCSpiltSDI.rc">
<Filter>资源文件</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="res\buttons.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\filelarge.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\filesmall.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\main.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\writelarge.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\writesmall.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\MFCSpiltSDIDoc.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\MFCSpiltSDI.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Toolbar.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Toolbar256.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\Damogu.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\author.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\MENU.bmp">
<Filter>资源文件</Filter>
</Image>
<Image Include="res\pcan.bmp">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<None Include="res\ribbon.mfcribbon-ms">
<Filter>资源文件</Filter>
</None>
<None Include="res\MFCSpiltSDI.rc2">
<Filter>资源文件</Filter>
</None>
<None Include="res\ribbon1.mfcribbon-ms">
<Filter>资源文件</Filter>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RESOURCE_FILE>MFCSpiltSDI.rc</RESOURCE_FILE>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,147 @@
// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
// (“Fluent UI”)。该示例仅供参考,
// 用以补充《Microsoft 基础类参考》和
// MFC C++ 库软件随附的相关电子文档。
// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
// 若要了解有关 Fluent UI 许可计划的详细信息,请访问
// https://go.microsoft.com/fwlink/?LinkId=238214.
//
// 版权所有(C) Microsoft Corporation
// 保留所有权利。
// MFCSpiltSDIDoc.cpp: CMFCSpiltSDIDoc 类的实现
//
#include "stdafx.h"
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
// ATL 项目中进行定义,并允许与该项目共享文档代码。
#ifndef SHARED_HANDLERS
#include "MFCSpiltSDI.h"
#endif
#include "MFCSpiltSDIDoc.h"
#include <propkey.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMFCSpiltSDIDoc
IMPLEMENT_DYNCREATE(CMFCSpiltSDIDoc, CDocument)
BEGIN_MESSAGE_MAP(CMFCSpiltSDIDoc, CDocument)
END_MESSAGE_MAP()
// CMFCSpiltSDIDoc 构造/析构
CMFCSpiltSDIDoc::CMFCSpiltSDIDoc() noexcept
{
// TODO: 在此添加一次性构造代码
}
CMFCSpiltSDIDoc::~CMFCSpiltSDIDoc()
{
}
BOOL CMFCSpiltSDIDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: 在此添加重新初始化代码
// (SDI 文档将重用该文档)
return TRUE;
}
// CMFCSpiltSDIDoc 序列化
void CMFCSpiltSDIDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: 在此添加存储代码
}
else
{
// TODO: 在此添加加载代码
}
}
#ifdef SHARED_HANDLERS
// 缩略图的支持
void CMFCSpiltSDIDoc::OnDrawThumbnail(CDC& dc, LPRECT lprcBounds)
{
// 修改此代码以绘制文档数据
dc.FillSolidRect(lprcBounds, RGB(255, 255, 255));
CString strText = _T("TODO: implement thumbnail drawing here");
LOGFONT lf;
CFont* pDefaultGUIFont = CFont::FromHandle((HFONT) GetStockObject(DEFAULT_GUI_FONT));
pDefaultGUIFont->GetLogFont(&lf);
lf.lfHeight = 36;
CFont fontDraw;
fontDraw.CreateFontIndirect(&lf);
CFont* pOldFont = dc.SelectObject(&fontDraw);
dc.DrawText(strText, lprcBounds, DT_CENTER | DT_WORDBREAK);
dc.SelectObject(pOldFont);
}
// 搜索处理程序的支持
void CMFCSpiltSDIDoc::InitializeSearchContent()
{
CString strSearchContent;
// 从文档数据设置搜索内容。
// 内容部分应由“;”分隔
// 例如: strSearchContent = _T("point;rectangle;circle;ole object;")
SetSearchContent(strSearchContent);
}
void CMFCSpiltSDIDoc::SetSearchContent(const CString& value)
{
if (value.IsEmpty())
{
RemoveChunk(PKEY_Search_Contents.fmtid, PKEY_Search_Contents.pid);
}
else
{
CMFCFilterChunkValueImpl *pChunk = nullptr;
ATLTRY(pChunk = new CMFCFilterChunkValueImpl);
if (pChunk != nullptr)
{
pChunk->SetTextValue(PKEY_Search_Contents, value, CHUNK_TEXT);
SetChunkValue(pChunk);
}
}
}
#endif // SHARED_HANDLERS
// CMFCSpiltSDIDoc 诊断
#ifdef _DEBUG
void CMFCSpiltSDIDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CMFCSpiltSDIDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
// CMFCSpiltSDIDoc 命令

View File

@ -0,0 +1,58 @@
// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
// (“Fluent UI”)。该示例仅供参考,
// 用以补充《Microsoft 基础类参考》和
// MFC C++ 库软件随附的相关电子文档。
// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
// 若要了解有关 Fluent UI 许可计划的详细信息,请访问
// https://go.microsoft.com/fwlink/?LinkId=238214.
//
// 版权所有(C) Microsoft Corporation
// 保留所有权利。
// MFCSpiltSDIDoc.h: CMFCSpiltSDIDoc 类的接口
//
#pragma once
class CMFCSpiltSDIDoc : public CDocument
{
protected: // 仅从序列化创建
CMFCSpiltSDIDoc() noexcept;
DECLARE_DYNCREATE(CMFCSpiltSDIDoc)
// 特性
public:
// 操作
public:
// 重写
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
#ifdef SHARED_HANDLERS
virtual void InitializeSearchContent();
virtual void OnDrawThumbnail(CDC& dc, LPRECT lprcBounds);
#endif // SHARED_HANDLERS
// 实现
public:
virtual ~CMFCSpiltSDIDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// 生成的消息映射函数
protected:
DECLARE_MESSAGE_MAP()
#ifdef SHARED_HANDLERS
// 用于为搜索处理程序设置搜索内容的 Helper 函数
void SetSearchContent(const CString& value);
#endif // SHARED_HANDLERS
};

View File

@ -0,0 +1,137 @@
// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
// (“Fluent UI”)。该示例仅供参考,
// 用以补充《Microsoft 基础类参考》和
// MFC C++ 库软件随附的相关电子文档。
// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
// 若要了解有关 Fluent UI 许可计划的详细信息,请访问
// https://go.microsoft.com/fwlink/?LinkId=238214.
//
// 版权所有(C) Microsoft Corporation
// 保留所有权利。
// MFCSpiltSDIView.cpp: CMFCSpiltSDIView 类的实现
//
#include "stdafx.h"
// SHARED_HANDLERS 可以在实现预览、缩略图和搜索筛选器句柄的
// ATL 项目中进行定义,并允许与该项目共享文档代码。
#ifndef SHARED_HANDLERS
#include "MFCSpiltSDI.h"
#endif
#include "MFCSpiltSDIDoc.h"
#include "MFCSpiltSDIView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMFCSpiltSDIView
IMPLEMENT_DYNCREATE(CMFCSpiltSDIView, CView)
BEGIN_MESSAGE_MAP(CMFCSpiltSDIView, CView)
// 标准打印命令
ON_COMMAND(ID_FILE_PRINT, &CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CMFCSpiltSDIView::OnFilePrintPreview)
ON_WM_CONTEXTMENU()
ON_WM_RBUTTONUP()
END_MESSAGE_MAP()
// CMFCSpiltSDIView 构造/析构
CMFCSpiltSDIView::CMFCSpiltSDIView() noexcept
{
// TODO: 在此处添加构造代码
}
CMFCSpiltSDIView::~CMFCSpiltSDIView()
{
}
BOOL CMFCSpiltSDIView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改
// CREATESTRUCT cs 来修改窗口类或样式
return CView::PreCreateWindow(cs);
}
// CMFCSpiltSDIView 绘图
void CMFCSpiltSDIView::OnDraw(CDC* /*pDC*/)
{
CMFCSpiltSDIDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
// TODO: 在此处为本机数据添加绘制代码
}
// CMFCSpiltSDIView 打印
void CMFCSpiltSDIView::OnFilePrintPreview()
{
#ifndef SHARED_HANDLERS
AFXPrintPreview(this);
#endif
}
BOOL CMFCSpiltSDIView::OnPreparePrinting(CPrintInfo* pInfo)
{
// 默认准备
return DoPreparePrinting(pInfo);
}
void CMFCSpiltSDIView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 添加额外的打印前进行的初始化过程
}
void CMFCSpiltSDIView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 添加打印后进行的清理过程
}
void CMFCSpiltSDIView::OnRButtonUp(UINT /* nFlags */, CPoint point)
{
ClientToScreen(&point);
OnContextMenu(this, point);
}
void CMFCSpiltSDIView::OnContextMenu(CWnd* /* pWnd */, CPoint point)
{
#ifndef SHARED_HANDLERS
theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);
#endif
}
// CMFCSpiltSDIView 诊断
#ifdef _DEBUG
void CMFCSpiltSDIView::AssertValid() const
{
CView::AssertValid();
}
void CMFCSpiltSDIView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMFCSpiltSDIDoc* CMFCSpiltSDIView::GetDocument() const // 非调试版本是内联的
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMFCSpiltSDIDoc)));
return (CMFCSpiltSDIDoc*)m_pDocument;
}
#endif //_DEBUG
// CMFCSpiltSDIView 消息处理程序

View File

@ -0,0 +1,59 @@
// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
// (“Fluent UI”)。该示例仅供参考,
// 用以补充《Microsoft 基础类参考》和
// MFC C++ 库软件随附的相关电子文档。
// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
// 若要了解有关 Fluent UI 许可计划的详细信息,请访问
// https://go.microsoft.com/fwlink/?LinkId=238214.
//
// 版权所有(C) Microsoft Corporation
// 保留所有权利。
// MFCSpiltSDIView.h: CMFCSpiltSDIView 类的接口
#pragma once
class CMFCSpiltSDIView : public CView
{
protected: // 仅从序列化创建
CMFCSpiltSDIView() noexcept;
DECLARE_DYNCREATE(CMFCSpiltSDIView)
// 特性
public:
CMFCSpiltSDIDoc* GetDocument() const;
// 操作
public:
// 重写
public:
virtual void OnDraw(CDC* pDC); // 重写以绘制该视图
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
// 实现
public:
virtual ~CMFCSpiltSDIView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// 生成的消息映射函数
protected:
afx_msg void OnFilePrintPreview();
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // MFCSpiltSDIView.cpp 中的调试版本
inline CMFCSpiltSDIDoc* CMFCSpiltSDIView::GetDocument() const
{ return reinterpret_cast<CMFCSpiltSDIDoc*>(m_pDocument); }
#endif

285
MFCSpiltSDI/MainFrm.cpp Normal file
View File

@ -0,0 +1,285 @@
// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
// (“Fluent UI”)。该示例仅供参考,
// 用以补充《Microsoft 基础类参考》和
// MFC C++ 库软件随附的相关电子文档。
// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
// 若要了解有关 Fluent UI 许可计划的详细信息,请访问
// https://go.microsoft.com/fwlink/?LinkId=238214.
//
// 版权所有(C) Microsoft Corporation
// 保留所有权利。
// MainFrm.cpp: CMainFrame 类的实现
//
#include "stdafx.h"
#include "MFCSpiltSDI.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWndEx)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWndEx)
ON_WM_CREATE()
ON_COMMAND_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_WINDOWS_7, &CMainFrame::OnApplicationLook)
ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_APPLOOK_WIN_2000, ID_VIEW_APPLOOK_WINDOWS_7, &CMainFrame::OnUpdateApplicationLook)
ON_COMMAND(ID_FILE_PRINT, &CMainFrame::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, &CMainFrame::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CMainFrame::OnFilePrintPreview)
ON_UPDATE_COMMAND_UI(ID_FILE_PRINT_PREVIEW, &CMainFrame::OnUpdateFilePrintPreview)
ON_WM_SIZE()
END_MESSAGE_MAP()
// CMainFrame 构造/析构
CMainFrame::CMainFrame() noexcept
{
// TODO: 在此添加成员初始化代码
m_formViewLeft = new CFormLeft();
theApp.m_nAppLook = theApp.GetInt(_T("ApplicationLook"), ID_VIEW_APPLOOK_OFF_2007_BLUE);
}
CMainFrame::~CMainFrame()
{
/*if (NULL != m_formViewLeft)
{
delete m_formViewLeft;
} */
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;
BOOL bNameValid;
m_wndRibbonBar.Create(this);
m_wndRibbonBar.LoadFromResource(IDR_RIBBON);//先绘制Ribbon然后创建
if (!m_wndStatusBar.Create(this))
{
TRACE0("未能创建状态栏\n");
return -1; // 未能创建
}
CString strTitlePane1;
CString strTitlePane2;
//CString strTitlePane3;
bNameValid = strTitlePane1.LoadString(IDS_STATUS_PANE1);
ASSERT(bNameValid); //断言函数,如果执行到这里错误的话就不再往下执行了
bNameValid = strTitlePane2.LoadString(IDS_STATUS_PANE2);
ASSERT(bNameValid);
//bNameValid = strTitlePane3.LoadString(IDS_STATUS_PANE3);
//ASSERT(bNameValid);
m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, strTitlePane1, TRUE), strTitlePane1);
//m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE3, strTitlePane3, TRUE), strTitlePane3);
m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, strTitlePane2, TRUE), strTitlePane2);
// 启用 Visual Studio 2005 样式停靠窗口行为
CDockingManager::SetDockingMode(DT_SMART);
// 启用 Visual Studio 2005 样式停靠窗口自动隐藏行为
EnableAutoHidePanes(CBRS_ALIGN_ANY);
// 基于持久值设置视觉管理器和样式
OnApplicationLook(theApp.m_nAppLook);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWndEx::PreCreateWindow(cs) )
return FALSE;
// TODO: 在此处通过修改
// CREATESTRUCT cs 来修改窗口类或样式
m_bCreateSplitter = FALSE;
return TRUE;
}
// CMainFrame 诊断
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWndEx::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWndEx::Dump(dc);
}
#endif //_DEBUG
// CMainFrame 消息处理程序
void CMainFrame::OnApplicationLook(UINT id)
{
CWaitCursor wait;
theApp.m_nAppLook = id;
switch (theApp.m_nAppLook)
{
case ID_VIEW_APPLOOK_WIN_2000:
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManager));
m_wndRibbonBar.SetWindows7Look(FALSE);
break;
case ID_VIEW_APPLOOK_OFF_XP:
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOfficeXP));
m_wndRibbonBar.SetWindows7Look(FALSE);
break;
case ID_VIEW_APPLOOK_WIN_XP:
CMFCVisualManagerWindows::m_b3DTabsXPTheme = TRUE;
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
m_wndRibbonBar.SetWindows7Look(FALSE);
break;
case ID_VIEW_APPLOOK_OFF_2003:
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2003));
CDockingManager::SetDockingMode(DT_SMART);
m_wndRibbonBar.SetWindows7Look(FALSE);
break;
case ID_VIEW_APPLOOK_VS_2005:
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2005));
CDockingManager::SetDockingMode(DT_SMART);
m_wndRibbonBar.SetWindows7Look(FALSE);
break;
case ID_VIEW_APPLOOK_VS_2008:
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerVS2008));
CDockingManager::SetDockingMode(DT_SMART);
m_wndRibbonBar.SetWindows7Look(FALSE);
break;
case ID_VIEW_APPLOOK_WINDOWS_7:
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows7));
CDockingManager::SetDockingMode(DT_SMART);
m_wndRibbonBar.SetWindows7Look(TRUE);
break;
default:
switch (theApp.m_nAppLook)
{
case ID_VIEW_APPLOOK_OFF_2007_BLUE:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_LunaBlue);
break;
case ID_VIEW_APPLOOK_OFF_2007_BLACK:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_ObsidianBlack);
break;
case ID_VIEW_APPLOOK_OFF_2007_SILVER:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver);
break;
case ID_VIEW_APPLOOK_OFF_2007_AQUA:
CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Aqua);
break;
}
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007));
CDockingManager::SetDockingMode(DT_SMART);
m_wndRibbonBar.SetWindows7Look(FALSE);
}
RedrawWindow(nullptr, nullptr, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE);
theApp.WriteInt(_T("ApplicationLook"), theApp.m_nAppLook);
}
void CMainFrame::OnUpdateApplicationLook(CCmdUI* pCmdUI)
{
pCmdUI->SetRadio(theApp.m_nAppLook == pCmdUI->m_nID);
}
void CMainFrame::OnFilePrint()
{
if (IsPrintPreview())
{
PostMessage(WM_COMMAND, AFX_ID_PREVIEW_PRINT);
}
}
void CMainFrame::OnFilePrintPreview()
{
if (IsPrintPreview())
{
PostMessage(WM_COMMAND, AFX_ID_PREVIEW_CLOSE); // 强制关闭“打印预览”模式
}
}
void CMainFrame::OnUpdateFilePrintPreview(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(IsPrintPreview());
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: 在此添加专用代码和/或调用基类
//if (!m_wndSplitter1.CreateStatic(this, 1, 2))
// return FALSE;
//CRect rect;
//GetClientRect(&rect); //得得到当前窗口的尺寸以便设置View大小
//if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CFormLeft), CSize(4*rect.Width()/5, rect.Height()), pContext) ||
// !m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CFormRight), CSize(rect.Width() / 5, rect.Height()), pContext)
// // ||!m_wndSplitter.CreateView(0, 2, RUNTIME_CLASS(CFormMid), CSize(360, 100), pContext)
// )
//{
// m_wndSplitter.DestroyWindow();
// return FALSE;
//}
//m_formViewLeft = (CFormLeft*)m_wndSplitter.GetPane(0, 0);
//((CFormLeft*)m_wndSplitter.GetPane(0, 0))->SetTarget(m_wndSplitter.GetPane(0, 1));
BOOL bResult = m_wndSplitter1.CreateStatic(this, 1, 2);
ASSERT(bResult);
m_wndSplitter2.CreateStatic(&m_wndSplitter1, 2, 1, WS_CHILD | WS_VISIBLE, m_wndSplitter1.IdFromRowCol(0, 1));
CRect rc;
GetClientRect(&rc);
m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CFormLeft), CSize(rc.Width() / 4, rc.Height() * 3 / 5), pContext);
m_wndSplitter2.CreateView(1, 0, RUNTIME_CLASS(CFormRight), CSize(rc.Width() / 4, rc.Height() * 2 / 5), pContext);
m_wndSplitter1.CreateView(0, 0, RUNTIME_CLASS(CMFCSpiltSDIView), CSize(rc.Width() * 3 / 4, rc.Height()), pContext);
//设置窗格的初始化的大小
m_wndSplitter1.SetColumnInfo(0, (int)(rc.Width() / 4), 10);
m_wndSplitter2.SetRowInfo(0, (int)(rc.Height() * 3 / 5), 10);
m_bCreateSplitter = TRUE;
//激活sceneview使得其可以接受命令消息
m_wndSplitter2.SetActivePane(0, 0, NULL);
m_formViewLeft = (CFormLeft*)m_wndSplitter2.GetPane(0, 0);
//return CFrameWndEx::OnCreateClient(lpcs, pContext);
return TRUE;
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWndEx::OnSize(nType, cx, cy);
CRect rect;
GetClientRect(&rect);
if (m_bCreateSplitter)
{
m_wndSplitter1.SetColumnInfo(0, (int)(rect.Width()* 3 / 4), 10);
m_wndSplitter1.SetColumnInfo(1, rect.Width() /4, 10);
m_wndSplitter2.SetRowInfo(0, (int)(rect.Height()*2/5), 10);
m_wndSplitter2.SetRowInfo(1, rect.Height() *3 / 5, 10);
m_wndSplitter1.RecalcLayout();
m_wndSplitter2.RecalcLayout();
}
}

73
MFCSpiltSDI/MainFrm.h Normal file
View File

@ -0,0 +1,73 @@
// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
// (“Fluent UI”)。该示例仅供参考,
// 用以补充《Microsoft 基础类参考》和
// MFC C++ 库软件随附的相关电子文档。
// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
// 若要了解有关 Fluent UI 许可计划的详细信息,请访问
// https://go.microsoft.com/fwlink/?LinkId=238214.
//
// 版权所有(C) Microsoft Corporation
// 保留所有权利。
// MainFrm.h: CMainFrame 类的接口
//
#pragma once
#include "FormLeft.h"
#include "FormRight.h"
#include "MFCSpiltSDIDoc.h"
#include "MFCSpiltSDIView.h"
class CMainFrame : public CFrameWndEx
{
protected: // 仅从序列化创建
CMainFrame() noexcept;
DECLARE_DYNCREATE(CMainFrame)
// 特性
public:
// 操作
public:
// 重写
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
// 实现
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // 控件条嵌入成员
CMFCRibbonBar m_wndRibbonBar;
CMFCRibbonApplicationButton m_MainButton;
CMFCToolBarImages m_PanelImages;
CMFCRibbonStatusBar m_wndStatusBar;
// 生成的消息映射函数
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnApplicationLook(UINT id);
afx_msg void OnUpdateApplicationLook(CCmdUI* pCmdUI);
afx_msg void OnFilePrint();
afx_msg void OnFilePrintPreview();
afx_msg void OnUpdateFilePrintPreview(CCmdUI* pCmdUI);
DECLARE_MESSAGE_MAP()
public:
CSplitterWnd m_wndSplitter1;
CSplitterWnd m_wndSplitter2;
BOOL m_bCreateSplitter;
//CSplitterWnd m_wndSplitter;
CFormLeft* m_formViewLeft;
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
public:
afx_msg void OnSize(UINT nType, int cx, int cy);
};

59
MFCSpiltSDI/Resource.h Normal file
View File

@ -0,0 +1,59 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by MFCSpiltSDI.rc
//
#define IDI_Damogu 99
#define IDD_ABOUTBOX 100
#define IDP_OLE_INIT_FAILED 100
#define IDB_WRITESMALL 110
#define IDB_WRITELARGE 111
#define IDB_MAIN 112
#define IDB_BUTTONS 113
#define IDB_FILELARGE 114
#define IDB_FILESMALL 115
#define IDR_POPUP_EDIT 119
#define ID_STATUSBAR_PANE1 120
#define ID_STATUSBAR_PANE2 121
#define ID_STATUSBAR_PANE3 118
#define IDS_STATUS_PANE1 122
#define IDS_STATUS_PANE2 123
#define IDS_STATUS_PANE3 124
#define IDR_MAINFRAME 128
#define IDR_MAINFRAME_256 129
#define IDR_MFCSpiltSDITYPE 130
#define IDR_PASTE_MENU 151
#define IDR_WINDOWS_MENU 152
#define IDR_THEME_MENU 200
#define ID_SET_STYLE 201
#define ID_VIEW_APPLOOK_WIN_2000 205
#define ID_VIEW_APPLOOK_OFF_XP 206
#define ID_VIEW_APPLOOK_WIN_XP 207
#define ID_VIEW_APPLOOK_OFF_2003 208
#define ID_VIEW_APPLOOK_VS_2005 209
#define ID_VIEW_APPLOOK_VS_2008 210
#define ID_VIEW_APPLOOK_OFF_2007_BLUE 215
#define ID_VIEW_APPLOOK_OFF_2007_BLACK 216
#define ID_VIEW_APPLOOK_OFF_2007_SILVER 217
#define ID_VIEW_APPLOOK_OFF_2007_AQUA 218
#define ID_VIEW_APPLOOK_WINDOWS_7 219
#define IDS_EDIT_MENU 306
#define IDR_RIBBON 307
#define IDD_FORM_LEFT 310
#define IDD_FORM_RIGHT 313
#define IDI_ICON1 316
#define IDB_PCAN 324
#define IDC_RADIO1 1004
#define ID_WRITE_PASTEASHYPERLINK 32770
#define ID_BUTTON2 32771
#define ID_BUTTON6 32779
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 325
#define _APS_NEXT_COMMAND_VALUE 32781
#define _APS_NEXT_CONTROL_VALUE 1009
#define _APS_NEXT_SYMED_VALUE 310
#endif
#endif

BIN
MFCSpiltSDI/res/Damogu.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
MFCSpiltSDI/res/MENU.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
MFCSpiltSDI/res/Toolbar.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
MFCSpiltSDI/res/buttons.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
MFCSpiltSDI/res/main.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
MFCSpiltSDI/res/pcan.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

18
MFCSpiltSDI/stdafx.cpp Normal file
View File

@ -0,0 +1,18 @@
// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
// (“Fluent UI”)。该示例仅供参考,
// 用以补充《Microsoft 基础类参考》和
// MFC C++ 库软件随附的相关电子文档。
// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
// 若要了解有关 Fluent UI 许可计划的详细信息,请访问
// https://go.microsoft.com/fwlink/?LinkId=238214.
//
// 版权所有(C) Microsoft Corporation
// 保留所有权利。
// stdafx.cpp : 只包括标准包含文件的源文件
// MFCSpiltSDI.pch 将作为预编译标头
// stdafx.obj 将包含预编译类型信息
#include "stdafx.h"

66
MFCSpiltSDI/stdafx.h Normal file
View File

@ -0,0 +1,66 @@
// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
// (“Fluent UI”)。该示例仅供参考,
// 用以补充《Microsoft 基础类参考》和
// MFC C++ 库软件随附的相关电子文档。
// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
// 若要了解有关 Fluent UI 许可计划的详细信息,请访问
// https://go.microsoft.com/fwlink/?LinkId=238214.
//
// 版权所有(C) Microsoft Corporation
// 保留所有权利。
// stdafx.h : 标准系统包含文件的包含文件,
// 或是经常使用但不常更改的
// 特定于项目的包含文件
#pragma once
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
#endif
#include "targetver.h"
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
// 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏
#define _AFX_ALL_WARNINGS
#include <afxwin.h> // MFC 核心组件和标准组件
#include <afxext.h> // MFC 扩展
#include <afxdisp.h> // MFC 自动化类
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxcontrolbars.h> // 功能区和控件条的 MFC 支持
#include <afxwin.h>
#include <afxcontrolbars.h>
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif

19
MFCSpiltSDI/targetver.h Normal file
View File

@ -0,0 +1,19 @@
// 这段 MFC 示例源代码演示如何使用 MFC Microsoft Office Fluent 用户界面
// (“Fluent UI”)。该示例仅供参考,
// 用以补充《Microsoft 基础类参考》和
// MFC C++ 库软件随附的相关电子文档。
// 复制、使用或分发 Fluent UI 的许可条款是单独提供的。
// 若要了解有关 Fluent UI 许可计划的详细信息,请访问
// https://go.microsoft.com/fwlink/?LinkId=238214.
//
// 版权所有(C) Microsoft Corporation
// 保留所有权利。
#pragma once
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h并将
// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
#include <SDKDDKVer.h>