vs安装包哪里有mfc_VS 2008和2010的MFC功能包

本文介绍了Visual C++ 2008和2010 MFC功能包中的新增功能,如Ribbon界面、Visual Studio风格的选项、用户自定义面板等,旨在提升桌面应用的用户体验。此外,文章还提到了一些实用的控件,如CMFCButton、CMFCListCtrl等,以及如何利用MFC实现更复杂的用户交互和自定义行为。
摘要由CSDN通过智能技术生成

vs安装包哪里有mfc

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual Studio 2010, which is now in beta.  There are really too many new features to cover in even a long article, so I'm going to single out a few things that I think may have an important impact.

在本文中,我将描述并展示其中的一些重要附加功能,这些附加功能已为Visual C ++ 2008的MFC功能包中的程序员提供。这些相同的功能在Visual附带的MFC库中Studio 2010,目前处于测试阶段。 即使是很长的文章,实际上也有太多新功能无法涵盖,因此我将列举一些我认为可能会产生重要影响的内容。

While all of the world seems to be gravitating toward a browser-centric programming model, lots of us programmers in the trenches know that there is still, and always will be, a place for desktop application programs and "thick client" application software.  MFC provides the toolkit for serious desktop application programmers.

尽管世界各地似乎都倾向于使用以MFC为认真的桌面应用程序程序员提供了该工具包。

The Ribbon

丝带

The most visible (visual) additions to MFC is support of a U/I feature that is associated with the slick Vista/Windows 7 "look" -- actually the look of Microsoft Office applications.  That look includes a "ribbon" rather than, or in addition to, an old fashioned menu bar.

MFC最明显(视觉)的添加是对与光滑的Vista / Windows 7“外观”(实际上是Microsoft Office应用程序外观)相关联的U / I功能的支持。 该外观包括“功能区”,而不是老式菜单栏,或者除了老式菜单栏之外,还包括“功能区”。

A ribbon instead of a menubar

Now you can create an MFC application program with the same scatter of gadgets and gizmos at the top.  The "Vista Orb" or "Pearl" (what I think of as the marble) in the top left corner really basically equates to the old "File" menu.  And the "ribbon groups" equate to menus, but in a graphical way that makes them a sort of combination menu and toolbar.

现在,您可以创建一个MFC应用程序,其顶部的小工具和小控件散布在同一位置。 左上角的“ Vista Orb”或“ Pearl”(我认为是 )实际上基本上等同于旧的“文件”菜单。 “色带组”等同于菜单,但是以图形方式使其成为菜单和工具栏的组合。

The underlying foundation does a lot of work to make all of this happen.  For instance, moving that marble and the Quick Access Toolbar buttons up onto the non-client area required quite a bit of hackwork, but it all gets done behind the scenes.  The functionality is now easily available to anyone who can click radio buttons in the AppWizard:

基础基础为完成所有这些工作做了很多工作。 例如,将大理石和“快速访问工具栏”按钮移到非客户区域上需要进行大量的黑客工作,但所有操作都在后台完成。 现在,只要单击AppWizard中的单选按钮,即可轻松使用此功能:

The AppWizard generates a marble-and-ribbon app with one click
very detailed example of lots of new features.

Visual Studio-Style Options

Visual Studio样式的选项

Basically all of the U/I features that you see in the Visual Studios IDE are are now available for use in your own programs:  Panels that dock or float, panel groups with tabs, MDI interface that uses tabs, hide-away panes that collapse against the sides or you can "pin" open for repeated use (my favorite feature).

基本上,您现在可以在自己的程序中使用在Visual Studios IDE中看到的所有U / I功能:停靠或浮动的面板,带有标签的面板组,使用标签的MDI界面,折叠的隐藏式窗格您也可以将其“钉”开以重复使用(我最喜欢的功能)。

A Visual Studio-type application... too much?

Did you notice how the menubar is positioned sideways in that figure?  Before taking the screenshot, I dragged the menu bar and let it snap to the left side of the client area.  There is a new class, CMFCMenubar that handles that automatically.  It basically simulates a traditional menu, but puts it all inside of a user-configurable buttonbar-type panel.  

您是否注意到菜单栏在该图中的侧面位置 ? 在截取屏幕截图之前,我拖动了菜单栏,并将其对齐到客户区的左侧。 有一个新类CMFCMenubar可以自动处理该类。 它基本上模拟了传统菜单,但是将其全部放置在用户可配置的按钮栏式面板中。

The same support exists for traditional toolbars and for all of the other panes you see there.  As a user, you can float them and reposition them however you like.  You can even float a panel outside of the application window altogether -- which lets you take advantage of the screen real estate on your second (or third) video monitor.

传统工具栏和您在此处看到的所有其他窗格都具有相同的支持。 作为用户,您可以根据需要浮动它们并重新定位它们。 您甚至可以将面板完全浮动在应用程序窗口之外-从而可以利用第二个(或第三个)视频监视器上的屏幕空间。

If you have ever handled any of that U/I overhead yourself, you know that it can get terribly complicated.  Just keeping track of how the user set things up in order to reproduce the layout later is a big pain.  So MFC now provides new tools just to keep track of user customization actions.  It is all tied together, and that AppWizard-generated program will automatically recall tools a user adds to the toolbar(s), menus and sub-menus he's added to the menubar, locations and states of each of the panels, and the main window location -- all without the programmer needing to add a single line of program code.

如果您曾经亲自处理过任何U / I开销,您就会知道它会变得非常复杂。 仅跟踪用户如何设置东西以便以后重现布局是一个很大的麻烦。 因此,MFC现在提供了新工具,仅用于跟踪用户自定义操作。 一切都绑在一起,由AppWizard生成的程序将自动调用用户添加到工具栏的工具,菜单和他添加到菜单栏的子菜单,每个面板的位置和状态以及主窗口。位置-所有这些都不需要程序员添加一行程序代码。

Too Much?

太多了?

Is all that user-customizability just too much?  What happens if your user hides the critical panel?  Are you going to get a lot of support calls?  Is that window too complicated?  Yes, Seek comfort from Cap'n Morgan, Yes, and Yes.

所有这些用户可定制性是否过多? 如果您的用户隐藏关键面板会怎样? 您会收到很多支持电话吗? 那个窗口太复杂了吗? 是的,向Cap'n Morgan寻求安慰,是的,是的。

But I think that there is an underlying method to all of this madness.  

但是我认为,对于所有这些疯狂都有一种潜在的方法。

Webbrowser-based apps are bound to be relatively simple and offer limited functionality, supporting only the kind of customizations that can be done with a cookie.  The remaining programming niche -- desktop apps -- is for full-featured kitchen-sink programs with truckloads of bells, whistles, and --  you-guessed-it -- user-customizable panels.

基于Web浏览器的应用程序必然相对简单并且功能有限,仅支持可以使用cookie进行的自定义类型。 其余的编程小众市场-桌面应用程序-适用于功能齐全的厨房水槽程序,带有大量的铃铛,口哨声和(您猜到了)用户可自定义的面板。

What Else is New?

还有什么是新的?

A lot of what's new in MFC is in support of big, complex programs.  But there are plenty of little things, too... objects that are useful in all types of programming task.  Let's look at a few of them:

MFC中的许多新功能都支持大型复杂程序。 但是也有很多小事情……在所有类型的编程任务中都有用的对象。 让我们看看其中的一些:

Buttons, etc.

Some new controls: Buttons, Font-selector, and Edit-browse tool

CMFCButton

按钮等
CMFC按钮

This is a sexied-up pushbutton.  You can assign two images (one for mouse-over "hot" look) and you can easily set a tooltip and show the button with or without the button text, below or on either side of the image.  There is even an auto-repeat option.

这是一个带有性别的按钮。 您可以分配两个图像(一个用于鼠标悬停在“热”外观上),并且可以轻松设置工具提示,并在图像的下方或两侧显示带有或不带有按钮文本的按钮。 甚至还有一个自动重复选项。

CMFCMenuButtonCMFCMenuButton

This is a button that when clicked displays a pop-up menu.  It can be set as shown with a vertical bar so that clicking the arrow pops up the menu, while clicking the body of the button executes the default action (the most recent menu item selected).  That's very handy in certain situations.

这是一个按钮,单击该按钮将显示一个弹出菜单。 可以使用竖线显示它的设置,以便单击箭头会弹出菜单,而单击按钮的主体将执行默认操作(选择的最新菜单项)。 在某些情况下这非常方便。

CMFCFontComboBoxCMFC字体组合框

Select a font without going through the rigmarole of a dialog box.  One option displays the fonts as shown -- each selection is drawn in its own font face.

选择一种字体而不用通过对话框的固定框。 一个选项显示如图所示的字体-每个选择均以其自己的字体绘制。

CMFCEditBrowseCtrlCMFCEditBrowseCtrl

Here's an often-needed combination:  An Edit control with a built-in "browse to locate" button.  Two common  types are provided to let your user browse to locate a particular file or a particular folder.   The "custom" version would let you browse for, say, a printer, a database, a network resource, or anything at all.

这是经常需要的组合: 具有内置“浏览定位”按钮的Edit控件。 提供了两种常用类型,以使您的用户浏览以查找特定

List Control Variants

New list-control variants

CMFCListCtrl

列表控件变体
CMFCListCtrl

This packages and simplifies the "report-style" version of the common ListView control.   It adds a number of handy features, including built-in sorting (and display of an arrow-decorated sort header) including multiple-column sorting.   It also lets you display specific cells in a desired font, color, and/or background shade.

这将打包并简化通用ListView控件的“报告样式”版本。 它增加了许多方便的功能,包括内置的排序(以及显示箭头修饰的排序标题),包括多列排序 。 它还可以让您以所需的字体,颜色和/或背景阴影显示特定的单元格。

CVSListBoxCVSListBox

A user-editable list control.   It lets your users put the items in a desired order by moving them up or down in the list.  You can let the user add or delete items.  There are standard buttons for these actions and you can add new buttons (for instance, a "disable but leave in the list" button came in handy in a program I wrote recently).

用户可编辑的列表控件。 通过在列表中上移或下移,您的用户可以按所需顺序放置项目。 您可以让用户添加或删除项目。 这些操作有标准按钮,您可以添加新按钮(例如,在我最近编写的程序中,“禁用但保留在列表中”按钮派上了用场)。

Masked Edit Box

Masked-edit control

CMFCMaskedEdit

蒙版编辑框
CMFC遮罩编辑

Here's one that most GUI programmers have had to write themselves at one time or another.  You want the user to input data in a certain format... say a phone number or a Social Security Number, or a product serial number, etc... and you'd like the control to enforce certain character types at certain locations, while filling in certain literal characters as well.

大多数GUI程序员不得不一次或多次编写自己的代码。 您希望用户以某种格式输入数据,例如电话号码或社会安全号码,或产品序列号等,并且您希望控件在某些位置强制使用某些字符类型,同时填写某些文字字符。

This new control offers great flexibility.  You set up a mask with ds and cs (and a few other characters) to identify which types of character can be input and where.  Then you can provide a template with any characters you want to be shown in the input box and underscore characters (_) for input character placeholders.  For instance, the code below sets up the masks for the two input boxes in the above figure.

这种新控件提供了极大的灵活性。 您可以使用d s和c s(以及其他一些字符)设置一个掩码,以识别可以输入哪些字符类型以及在何处输入字符。 然后,您可以为模板提供要在输入框中显示的任何字符,并为输入字符占位符加下划线( _ )。 例如,下面的代码为上图中的两个输入框设置了掩码。

m_wndMaskEdit1.EnableMask( 
    " ddd  ddd dddd",  // The mask string
    "(___) ___-____",  // Literal, "_" char = character entry
    ' '                // Default char
); 
m_wndMaskEdit1.SetValidChars(NULL); // Valid string characters

m_wndMaskEdit2.EnableMask( 
    "       cc       ddddd-dddd"), 
    "State: __, Zip: _____-____", 
    ' '
); 

Tear-off Menus

Tear-off menu support

CWinAppEx::EnableTearOffMenus

撕纸菜单
CWinAppEx :: EnableTearOffMe 努斯

Here's a little feature that sort of illustrates how far the MFC coders went toward whiz-bang user customization.  You can create a menu that your user can "tear off" and turn into a floating palette.

这是一个小功能,它说明了MFC编码人员朝着狂飙用户自定义迈进了多远。 您可以创建一个菜单,您的用户可以“撕下”菜单并变成一个浮动调色板。

Desktop Alert Popup Box

Desktop Alert box

CMFCDesktopAlertWnd

桌面警报弹出框
CMFCDesktopAlertWnd

The now-standard way to inform your user about updates, task completion, or other important information is to display a small box near the status tray in the taskbar.  MFC supports this with all imaginable options -- animation effects, semi-transparency, user controls, auto-close timing... In fact, your little notification box can be entirely customized by using a dialog box template.

现在,通知用户有关更新,任务完成或其他重要信息的标准方法是在任务栏中的状态托盘附近显示一个小框。 MFC通过所有可以想象的选项来支持此功能-动画效果,半透明,用户控件,自动关闭定时...实际上,可以使用对话框模板完全自定义您的小通知框。

Shell/Windows Explorer Views

Shell/Explorer toolkit
CMFCShellTreeCtrl and CMFCShellListCtrl

Shell / Windows资源管理器视图 CMFCShellTreeCtrlCMFCShellListCtrl

These are standard Tree and List controls that have been enhanced to automatically provide views of all Windows Shell objects.  If you have ever gone through the process of reproducing your own version of the Windows Explorer, you know that handling PIDLs can be a complex task.   This makes it effortless.  I found it unusual that the sample projects (and the AppWizard-generated projects) all show the tree with the old-fashioned "pluses and dotted-lines" look rather than the new-fangled Win7-look trees.  

这些是标准的“树”和“列表”控件,它们已得到增强,可以自动提供所有Windows Shell对象的视图。 如果您曾经经历过复制自己的Windows资源管理器版本的过程,那么您就会知道处理PIDL可能是一项复杂的任务。 这使它毫不费力。 我发现示例项目(以及由AppWizard生成的项目)全部显示树具有老式的“加号和虚线”外观而不是新的Win7外观树是不寻常的。

The Sample Programs

示例程序

I had trouble obtaining the sample projects that I used to generate the screenshots for this article.  It appears that they were removed from the VS 8 MFC Feature Pack download.  I eventually found them here:

我在获取用于生成本文屏幕截图的示例项目时遇到了麻烦。 看来它们已从VS 8 MFC Feature Pack下载中删除。 我最终在这里找到他们:

    Microsoft Visual C++ 2008 SP1 Sample Library

Microsoft Visual C ++ 2008 SP1示例库

http://www.microsoft.com/downloads/details.aspx?familyid=9761BB57-F066-4B70-9318-3965C5E68AAD http://www.microsoft.com/downloads/details.aspx?familyid=9761BB57-F066-4B70-9318-3965C5E68AAD

But even then, they would refuse to install.  So I used WinRAR to break out the files from the download distribution EXE.  I understand that if you download the VS 2010 beta, you will get the full set of "Feature Pack" sample projects, so you might consider going that way.  Note, however that VS2010 solution and project files are not compatible with VS2008.

但是即使那样,他们仍然拒绝安装。 因此,我使用WinRAR从下载分发EXE中分解出文件。 我了解,如果下载VS 2010 beta版 ,您将获得全套的“功能包”示例项目,因此您可以考虑采用这种方式。 但是请注意,VS2010解决方案和项目文件与VS2008不兼容。

References:

MFC Feature Pack for Visual C++ 2008

适用于Visual C ++ 2008的MFC功能包

http://msdn.microsoft.com/en-us/library/bb982354.aspx http://msdn.microsoft.com/en-us/library/bb982354.aspx

Walkthroughs (MFC Feature Pack)

演练(MFC功能包)

http://msdn.microsoft.com/en-us/library/bb982451.aspx http://msdn.microsoft.com/en-us/library/bb982451.aspx

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

=-=-=-=-=-=-=-=-=-=-=-=-=- =-=-=-=-=- =-=-=-=-=- =-=-=-=-=- =-=-=-=-=- =-=-=-=-=- =-=-=-=

If you liked this article and want to see more from this author, please click the Yes button near the:

如果您喜欢这篇文章,并希望从该作者那里获得更多信息,请单击旁边的按钮:

      Was this article helpful?

本文是否有帮助?

label that is just below and to the right of this text.   Thanks!

此文字下方和右侧的标签。

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

=-=-=-=-=-=-=-=-=-=-=-=-=- =-=-=-=-=- =-=-=-=-=- =-=-=-=-=- =-=-=-=-=- =-=-=-=-=- =-=-=-=

翻译自: https://www.experts-exchange.com/articles/2128/MFC-Feature-Pack-for-VS-2008-and-2010.html

vs安装包哪里有mfc

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值