[英]How to separate GUI from logic in MFC?
I want to develop a MFC application in VS2010. 我想在VS2010中开发MFC应用程序。 I hope to separate GUI from the logic, so that modifying GUI can become much easier.
我希望将GUI与逻辑分开,以便修改GUI变得容易得多。 But I don't know how to design the classes to implement this function.
但是我不知道如何设计类来实现此功能。 Which design pattern should I use?
我应该使用哪种设计模式? Does MFC have any special way to deal with the problem?
MFC是否有任何特殊的方法来解决此问题?
Moreover, I am not familiar with design patterns. 而且,我对设计模式不熟悉。 So I hope someone can give me samples or detailed articles explaining this.
因此,我希望有人可以给我提供样本或详细的文章来对此进行解释。 (Also I prefer a less complicated pattern! ^^)
(而且我更喜欢一个不太复杂的模式!^^)
Thank you very much! 非常感谢你!
The MFC already provide such a separation in their SDI/MDI based templates. MFC已经在其基于SDI / MDI的模板中提供了这种分离。 For example, you have a CWinApp instance and a CMainFrame for the program itself.
例如,您有一个CWinApp实例和一个程序本身的CMainFrame。 For each file in MDI apps you have a CDocument and a CView class.
对于MDI应用程序中的每个文件,您都有一个CDocument和一个CView类。
Note: 注意:
May be it will be helpful http://martinfowler.com/eaaDev/uiArchs.html . 可能会对http://martinfowler.com/eaaDev/uiArchs.html有所帮助。 Also try to find MVC (model/view/controller) pattern.
还尝试找到MVC(模型/视图/控制器)模式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.