在MFC中可以创建多种类型的窗口程序,如对话框程序、单文档结构程序(非文档/视图结构)、单文档(文档/视图结构)以及多文档视图结构程序等。

在编写一般的小工具时,我们的首选显然是对话框程序,不过基于对话框的程序不支持视图类,有些功能实现起来会麻烦许多。此时我们可以使用CFormView作为基类来创建单文档(非文档/视图结构)和单文档(文档/视图结构)的程序。

一、使用MFC向导创建程序

(1)单文档(文档/视图结构)

(2)不需要状态栏和工具栏

(3)使用CFormView作为基类

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAkQAAAGdCAYAAADzOWwgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAB0RSURBVHhe7d0LkF11neDxX3cnTZAFR1EUCbs6kwYTQs2MomMScXxtOQmwxnUn4ywKO+tsWgslAct1cEFnSGqASg0kuNTYvaWjsDuuWV2zNZLW8bHuaBJQUayEhKQjw0segUDIux/J3XPOPaf79iNJhzSB9P/zsf70veece/v+O+D91v+c22natm1bLRP5OHjwYBw4cCD6+/uLceH/7A8AgIngp5efEpMnT45JkyZFS0tLNDc3F6OpqSmannzyySKI8hiqgqivr68Y7/pGxOPXvrF8GgCAE9OZS++PNf++NVpbW4dEURFD2WiuVofykatu53EEADBR5Is+1QJQNaruac4PaIygamf+FQBgosiDqBqNMZSPIStE1ajCCABgomgMoap1qvsDQZSrblc7AQAmisYIqkbVPkUQ5aoNjQMAYKIYLYSqMXANUaVx5/PVt/H78VzHonjqcx+Kxz/+R/HIpX8Yj3zkffH03/xl9HZvLI8CADh+8rYZHkTV7VGvIcpHfsDzUfvNj6K5NWLK786KSa84JVpOmxItU1ri5N99c/RNao3tP/9peSQAwPEzPIQa7xcrRLlqQ+N4PmoP/Cz2/OMdsXvN96P1DW+O1ulvjZf94bzY9Zsn4zffXhW9O58rjwQAOH7ythkeQtUY9aLqxm1Hq/mZ/jjlQzfG7ns2xlOrfxCPrPxO7Hv02Xju3nti37Yno7e3tzzyMLrao6m9K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N8eq/3tfPPjUnugtdvUV/wQAmOiaP770yrjkkmvi1us/HOdFd/zD314Tn7q6MzZs31weAgAwsTWfUt6I1jOi7V3z45OfuzW+cPPCmHn6zHIHAMDE5i93BQCSJ4gAgOQJIgAgeYIIAEieIAIAkieIAIDkCSIAIHmCCABIniACAJIniACA5AkiACB5gggASJ4gAgCSJ4gAgOQJIgAgeYIIAEieIAIAkieIAIDkCSIAIHmCCABIniACAJIniACA5AkiACB5gggASJ4gAgCSJ4gAgOQJIgAgeYIIAEieIAIAkieIAIDkCSIAIHmCCABIniACAJIniACA5I0SRH2x6e+uja890FfeBwCY2Jpj23fjP//xpfGxj30srrjiirjyyk/Ff1u/N+7tuLY8BABgYquvEL3hI3H9F78Yt912W9x6661x8803x0033VTsAgCY6AZPmT37w1hWrBBdGVdffXV85jOfKXcAAExsg0H0infHp2+7LW64+qPxn665MW666fPlDgCAia08ZTY1zihuRJxy1uui77t/HVd/7K/KLQAAE1u5QnRX3FFdVP2pJfGVX+yMvniuvgsAYIJrjh2PRpzxR/GRIRdVXxMfPPvs8hAAgImteds/b44zzqpOmAEApKf5lz84I97+ptby7qC+/vIGAMAE13zXhR+Ktw30UHd87cqPxn+87DPRddo7y20AABNb8+cvmVrezLXFn976pfjy7V+Om6+aU24DAJjYBn8PEQBAogQRAJA8QQQAJE8QAQDJE0QAQPIEEQCQPEEEACRPEAEAyRNEAEDyBBEAkDxBBAAk75BBVKvVylsAABNL3jmNrTNqEIkhAGCiqSKosXOq20UQCSAAIGVFEDU1NRV3AABSNOopM4EEAEw0ed9Uo1LdPuRF1aIIAJiohodRc3Vn+A4AgImkap3G5qluH/IaotG2AQCcqKr4aRyVgVNmhzsIAOBE19zcPGrv5KM4ZZaPSrGxfAAAwERRNc+oY+fOnbX89xAdPHgwDhw4EH19fdHb2xs9PT3xjq8fiBvPvjve8573lE8FAHBimTp1apy59P5YfdG+mDJlSrS2tsakSZOK0dLSUoymXbt2jQiifORB9Pav9cXj176xfDoAgBNTHkTf/Te9cdJJJ8XkyZOLkQdRflZsSBDlIw+i/v7+YuSrRG+7Y1/5NAAAJ7Yf/NuDQ2KoWiEqLhXavXt3LV8dqlaJqiDKR7ValIdSNfJjGo9v/FoNAIDjqfF6oOpa6PxrtQKUx09jCDXGULFCtGfPniKIqqhpjJ8qjKoQqr5WEdR4OyeIAIAXQxVDucYgaoyeKoyq29W+4vi9e/cOCaLqdmMYVfdHO04QAQAvtsMFUePtKoIaYygfRRBVUdP4tTGA8pHfr/ZXx1RfGwcAwAutsTmqEKqiqBoDsdNwe3gI5aM4ft++fdlz1mNmeOhU8VON0Y4ZbQAAHE+NIdQ4quBp/No4Bvbt378/a5h6yDRGzmgBNNr+xpGrvgIAHC952FRfG0cVPdXtIRHUuL+npydrmJGR0xhCo+0fPnLVVwCAF1Jjc+RBM/zraGN4HA1+bYr/Dz47tetqZkU9AAAAAElFTkSuQmCC" alt="" />

(4)使用向导创建好的程序窗口

二、程序初始化设置

在这个由MFC向导创建的程序窗口中有些功能或许是我们不想要的,比如视图标题、视图凹陷效果、菜单栏、鼠标拖动窗口边框调整窗口大小等。

1. 不显示视图标题、禁止以拖动方式调整窗口大小、禁用菜单栏

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: 在此处通过修改
// CREATESTRUCT cs 来修改窗口类或样式
cs.style &= ~FWS_ADDTOTITLE; /* 不显示视图标题 */
cs.style &= ~WS_THICKFRAME; /* 禁止以拖动方式调整窗口大小 */
cs.hMenu = NULL;
return TRUE;
}

2. 去除视图凹陷效果

BOOL CTestView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: 在此处通过修改
// CREATESTRUCT cs 来修改窗口类或样式
cs.style &= ~WS_BORDER; /* 去除视图凹陷效果 */ return CFormView::PreCreateWindow(cs);
}

3. 修改程序窗口标题

BOOL CTestApp::InitInstance()
{ .... .... .... m_pMainWnd->SetWindowText( L"测试程序" ); /* 修改程序窗口标题 */ // 唯一的一个窗口已初始化,因此显示它并对其进行更新
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
// 仅当具有后缀时才调用 DragAcceptFiles
// 在 SDI 应用程序中,这应在 ProcessShellCommand 之后发生
return TRUE; }

结果:

下一篇我会教大家如何动态创建好看的选项卡

代码:tab.zip

如何优雅的写UI——(2)MFC下基于CFormView的文档视图程序的更多相关文章

  1. MFC中 创建基于CFormView的文档视图程序

    在MFC中可以创建多种类型的窗口程序,如对话框程序.单文档结构程序(非文档/视图结构).单文档(文档/视图结构)以及多文档视图结构程序等. 在编写一般的小工具时,我们的首选显然是对话框程序,不过基于对 ...

  2. MFC单文档视图程序简介

    在视图应用程序中,应用程序的数据由文档对象代表,数据的视图由视图对象代表.MFC的Cdocument类是文档对象的基类,Cview类是视图对象的基类.应用程序的主窗口,其操作功能在MFC的Cframe ...

  3. VS2010/MFC编程入门之二(利用MFC向导生成单文档应用程序框架)

    VS2010/MFC编程入门之二(利用MFC向导生成单文档应用程序框架)-软件开发-鸡啄米 http://www.jizhuomi.com/software/141.html   上一讲中讲了VS20 ...

  4. 如何优雅的写UI——(1)MFC六大核心机制-程序初始化

    很多做软件开发的人都有一种对事情刨根问底的精神,例如我们一直在用的MFC,很方便,不用学太多原理性的知识就可以做出各种窗口程序,但喜欢钻研的朋友肯定想知道,到底微软帮我们做了些什么,让我们在它的框架下 ...

  5. VC++ MFC单文档应用程序SDI下调用glGenBuffersARB(1, &pbo)方法编译通过但执行时出错原因分析及解决办法:glewInit()初始化的错误

    1.问题症状 在VC++环境下,利用MFC单文档应用程序SDI下开发OpenGL程序,当调用glGenBuffersARB(1, &pbo)方法编译通过但执行时出错,出错代码如下: OpenG ...

  6. 深入分析MFC文档视图结构(项目实践)

    k_eckel:http://www.mscenter.edu.cn/blog/k_eckel 文档视图结构(Document/View Architecture)是MFC的精髓,也是Observer ...

  7. mfc学习---文档视图架构

    MFC的AppWizard可以生成三种类型的应用程序:基于对话框的应用.单文档应用(SDI)和多文档应用(MDI).   一般情况下,采用文档/视结构的应用程序至少应由以下对象组成:       1. ...

  8. MFC文档视图结构学习笔记

    文档/视图概述 为了统一和简化数据处理方法,Microsoft公司在MFC中提出了文档/视图结构的概念,其产品Word就是典型的文档/视图结构应用程序 MFC通过其文档类和视图类提供了大量有关数据处理 ...

  9. VS2010-MFC(利用MFC向导生成单文档应用程序框架)

    一.VC++与MFC 讲VC++免不了要提MFC,MFC全称Microsoft Foundation Classes,也就是微软基础类库.它是VC++的核心,是C++与Windows API的结合,很 ...

随机推荐

  1. GIL解释锁及进程池和线程池

    官方介绍 ''' 定义: In CPython, the global interpreter lock, or GIL, is a mutex that prevents multiple nati ...

  2. windows用xstart远程连接linux图形用户界面

    转载:https://blog.csdn.net/yabingshi_tech/article/details/51839379 双击xstart 输入:/usr/bin/xterm -ls -dis ...

  3. 使用 swoole_process 实现 PHP 进程池

    swoole_process 主要是用来代替 PHP 的 pcntl 扩展.我们知道 pcntl 是用来进行多进程编程的,而 pcntl 只提供了 fork 这样原始的接口,容易使用错误,并且没有提供 ...

  4. 洛谷P5082 成绩

    原来的空间限制是5MB,其实是很足够的,现在调成128MB,变成了没有思维难度的大水题. 不过,我还是想说一下空间限制为5MB的解题思路. 题目要求的是(每一科的满分之和*3-每一科的实际得分之和*2 ...

  5. CF245H Queries for Number of Palindromes(回文树)

    题意翻译 题目描述 给你一个字符串s由小写字母组成,有q组询问,每组询问给你两个数,l和r,问在字符串区间l到r的字串中,包含多少回文串. 输入格式 第1行,给出s,s的长度小于5000 第2行给出q ...

  6. Unity Shader (四)顶点程序示例

    1.在顶点函数中实现凸起效果 Shader "Custom/Example" { properties { _R(,))= //圆的半径,也是凸起的范围 _OX(,))= //x轴 ...

  7. OpenCV图像处理篇之边缘检測算子

    3种边缘检測算子 灰度或结构等信息的突变位置是图像的边缘,图像的边缘有幅度和方向属性.沿边缘方向像素变化缓慢,垂直边缘方向像素变化剧烈.因此,边缘上的变化能通过梯度计算出来. 一阶导数的梯度算子 对于 ...

  8. Codeforces 528A Glass Carving STL模拟

    题目链接:点击打开链接 题意: 给定n*m的矩阵.k个操作 2种操作: 1.H x 横向在x位置切一刀 2.V y 竖直在y位置切一刀 每次操作后输出最大的矩阵面积 思路: 由于行列是不相干的,所以仅 ...

  9. Codeforces--602A--Two Bases(水)

    Two Bases Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit St ...

  10. powerpoint(ppt) 的制作

    1. 幻灯片母版 所谓母版,是共享的部分,也即想在全部幻灯片重复出现的元素. 首先,幻灯片母版在菜单栏的[视图]选择[幻灯片母版]显示和查看. 通过幻灯片母版的编辑和设计,可进一步: 在幻灯片的相关位 ...