如何自动生成设置/选项对话框?
将 Visual Studio 2010 C++ 与 MFC 结合使用。我的应用程序中可配置设置的数量正在慢慢增加。我设法设计了一个设置类,其中添加一行将向程序添加一个设置,并支持将该设置读/写到我的 ini 文件中。然而,我仍然需要进入我的 GUI 编辑器并编辑选项对话框、移动文本框、对齐标签等,这有点痛苦。
我如何自动生成我的选项对话框,以便我可以给它一个数据结构,并且它可以为我生成选项界面?如果它是类似列表框的东西就可以了。我正在考虑类似 Visual Studio 属性对话框,它具有以编程方式生成的外观:
我只是想从概念上概述什么控件最好以及如何将它们组合在一起。当然,如果有一个讨论这个问题的网页链接那就太好了。
Using Visual Studio 2010 C++ with MFC. The number of configurable settings in my application is slowly creeping up. I managed to design a settings class where adding a single line will add a setting to the program and support reading/writing that setting to my ini file. However, I still need to go into my gui editor and edit the options dialog box, moving text boxes around, aligning labels etc. which is kind of a pain.
How would I autogenerate my options dialog box such that I could give it a data structure and it could generate the option interface for me? It's okay if it's something like a list box. I'm thinking something like the the Visual Studio properties dialog box which has the look of something that's programmatically generated:
I'm just trying to get a conceptual overview of what controls would be best and how to piece it together. Of course if there is a link to a web page discussing this that would be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要 CMFCPropertyGridCtrl 类。它是在 MFC 更新之一中引入的,但我不确定它们是否预装在 Visual Studio 2010 中;您可能需要安装一些额外的东西。
You want the
CMFCPropertyGridCtrl
class. It was introduced in one of the MFC updates, but I'm not sure whether or not they come pre-installed with Visual Studio 2010; you may need to install something extra.