Visual Studio中的可重用用户界面元素 [英] Reusable User Interface elements in Visual Studio

查看:128
本文介绍了Visual Studio中的可重用用户界面元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.

我正在尝试为几个 desktop 应用程序项目制作一些可重用的GUI组件.这些项目都是基于Windows(Win7),Visual Studio,C ++的.您认为什么是解决此问题的最佳方法?

现在,我正在考虑以下两个想法之一:
-MFC ActiveX控件.
-MFC扩展Dll.

到目前为止,ActiveX的优点是能够直接集成到VS资源编辑器中,这将使集成更加容易.
另一方面,ActiveX每个.OCX只允许1个GUI组件(我错了吗?是否可以在.OCX文件中合并1个以上的控件?),这意味着我将不得不分发很多.OCX文件,但看起来不正确.
您能告诉我ActiveX是否仍然被认为是一种现代"的做事方式吗?我不想使用即将被弃用的东西.

谢谢.

Hi.

I am trying to make some reusable GUI components for several desktop application projects. These projects are all Windows (Win7), Visual Studio, C++ based. What do you think would be the best way to approach this problem?

Right now i was thinking about one of these 2 ideas:
- MFC ActiveX Control.
- MFC extension Dll.

So far ActiveX has the benefit of being able to be integrated directly in the VS resource editor and this would make the integration easier.
On the other hand, ActiveX would allow only 1 GUI component per .OCX (am i wrong here? is it possible to incorporate more that 1 control in an .OCX file?) and this would mean that i would have to distribute a lot of .OCX files and it would just not look right.
Can you tell me if ActiveX is still considered a "modern" way of doing things? I wouldn''t want to use something that is about to be deprecated.

Thanks.

推荐答案

我的选择是一个DLL,该DLL可以导出一个简单的C接口-本质上是用于初始化库并注册所有窗口类的东西.然后,是否使用其他库(例如MFC)来实现控件,对于代码的客户端来说就无关紧要了.

其背后的原因是,将其他内容包装在一组简单的WIN32 Windows类周围相对比较容易,而在底部则相反,这是很痛苦的事情.
My choice would be a DLL that exports a simple C interface - essentially something to initialise the library and register all the window classes. Whether you use another library (e.g. MFC) to implement your controls doesn''t then matter for the client of your code.

The reasoning behind that is that it''s relatively simple to wrap other stuff around a simple set of WIN32 windows classes while it''s a right royal pain in the bottom the other way around.


单个DLL实际上可以托管多个控件(例如,参见ComCtl32.dll).
我认为COMMFC现代得多"(例如, WinRT基于COM a> [ ^ ]).
A single DLL can actually host multiple controls (see, for instance, ComCtl32.dll).
COM is far ''more modern'' than MFC, in my opinion (for instance, WinRT is COM-based[^]).


这篇关于Visual Studio中的可重用用户界面元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆