Obtaining MFC Feature Pack GUI elements in .NET WinForms
The MFC Feature Pack (and VS 2010) adds out-of-the-box support for several "modern" GUI elements (such as MDI with tabbed documents, the ribbon, and a Visual Studio-style interface with docking panels). These are a boon to those of us that have to support legacy MFC-based applications and want to update their look-and-feel, and a sign that Microsoft has not completely abandoned unmanaged C++ development. However, with the push so strongly in favor of .NET, WinForms, and managed code (and for plenty of good reasons), there seems little reason to develop new applications in unmanaged C++/MFC.
The question then becomes how does one obtain these GUI elements in a WinForms application. Almost all of the add-ons and libraries I have found so far cost money, and introduce additional dependencies. I don't have a budget to buy third-party libraries, and the controls provided by Microsoft in MFC for free seem sufficient for our needs. But I still have reservations about learning MFC to develop a new application. Not only does the investment in time seem significant (by all accounts, MFC seems particularly difficult to learn, even for experienced .NET developers--although I am willing to try), but the question of MFC's lifespan is raised as well. Certainly, give开发者_高级运维n the millions of lines of code and existing apps written in native C++, it will be around for some time, but the handwriting seems to be on the wall, so to speak, that it's no longer Microsoft's touted development platform.
It seems like these features should be available by now in WinForms without the need for third-party add-ons, or devoting a lot of time and resources to custom-drawing EVERYTHING. Am I just missing something? I find very little online that compares these new features of MFC to what is available in WinForms, mainly because most everything written on MFC pre-dated its most recent update, before which it looked admitted "dated," and with its other flaws, was hardly an appealing platform for new development. With the very recent release of VS 2010, we have a while to wait before WinForms gets updated again. What routes are you guys taking for applications whose customers demand a modern-looking UI on a budget?
Most of these features are provided to .NET developers through WPF, not WinForms. Nothing is going to meet your expectation of "should be available by now in WinForms" because WinForms is not being added to. Like COM before it, "it's not dead, but it's done".
I think you have your answer in your question. If you're maintaining an MFC app, go ahead and make it look 21st century. If you know MFC well, go ahead and use it for a new app. If you've made the switch to managed code, and would need to learn MFC to use it, put that energy into learning WPF. There are some "converters" that change WinForms to WPF to save you some time and help you understand WPF more quickly - http://wf2wpf.codeplex.com/ for example.
WinForms are pretty much in Zombieland -- not quite dead, but definitely not really alive either. I'd say the chances of a ribbon bar for WinForms rank right up there with the chances of a new version of MS-DOS.
If you want new features like ribbons now, MFC is virtually the only choice without spending extra money for a third party library. Microsoft has said that a Ribbon control for WPF 4 should be available Real Soon Now, but AFAIK, it's not available yet (though a preview has been available for a while).
精彩评论