MFC:如何创建带有列表框和多个页面的选项对话框?
使用 Visual Studio 2010 C++ 和 MFC 进行开发。我想创建一个可以显示多个选项的选项(首选项/设置)对话框。在考虑了许多不同的选项对话框 UI 后,我想我喜欢类似于 Visual Studio 的选项对话框的多页列表框样式(但我不需要树视图,列表框就可以了)。
实现这个的好方法是什么?我是否使用 CListBox,然后处理选择事件来加载各个页面?我是 MFC 新手,各个页面到底是什么?像面板之类的东西?理想情况下,我会在资源编辑器中设计它们,然后能够加载它们。
Developing using Visual Studio 2010 C++ and MFC. I want to create an options (preferences/settings) dialog box that can display several options. After considering many different options dialog box UIs I think I like the listbox-with-multiple-pages-style similar to visual studio's option dialog box (but I don't need the treeview, a list box is fine).
What's a good way to implement this? Do I use a CListBox and then handle the selection event to load up the individual pages? I'm new to MFC, what would the individual pages even be? Something like a panel? Ideally I would design them in the resource editor and then be able to load them up.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看 http://www.codeproject.com/KB/dialog/embedded_dialog.aspx 一种可能的方法。
各个属性页可以设计为资源编辑器中的对话框,然后通过处理 LVN_ITEMCHANGED 消息,根据列表框中的选择,相关页面可以显示在主对话框中。
Take a look at http://www.codeproject.com/KB/dialog/embedded_dialog.aspx for one possible way of doing this.
The individual property pages can be designed as dialogs in the resource editor, and then the relevant page can be displayed in your main dialog depending on the selection in the list box, by handling the LVN_ITEMCHANGED message.
请参阅 CPropertySheet 和 CPropertyPage 类。这使您可以轻松管理具有多个视图的属性窗口。
See CPropertySheet and CPropertyPage classes. This allows you to easily manage a properties window with several views.