是否可以使用 CListCtrl 就地编辑数据 - 如果不能,任何人都可以建议 MFC 中的替代控件吗?
我正在设计一个 MFC 应用程序,其中我希望有一个包含 2 列的网格:两者均可编辑,用户将在其中输入数据,并且应用程序将收到有关它的通知。用户可以根据需要增加/减少行数 - 对于这种需求,理想的 MFC 控件是什么?
这是我第一次设计 MFC 应用程序,所以如果听起来太菜鸟,请不要介意:)
I'm designing a MFC app in which I'd like to have a grid with 2 coloumns : both editable in which the user will input data and the app will get notified about it. The number of rows can be increased/decreased by the user as he wants - What would be the ideal MFC control to use for this kind of requirement ?
This is my first time designing a MFC app , so dont mind if it sounds too noobish :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不是一个新手问题。实际上,您已经遇到了一个困扰每个 MFC 开发人员 15 年来的问题:MFC 库没有内置的网格控件。我想,您正在寻找一种网格控制。据我所知,不可能在 CListCtrl 中编辑两列。仅第一列“标签”可以编辑。
对于网格控件,您必须寻找可以添加到您的项目中的适当的第三方工具,例如 ActiveX 控件。 (我记得旧的 Visual Studio 6 附带了一个“MS FlexGrid”,您可以将其与组件库一起添加到项目中,但我从未使用过它,所以我不知道它是否是一个不错的选择。但是也许足以满足您的目的。)大多数第三方网格控件都需要许可费,但这里有一个(相当强大的)免费网格(至少免费,但没有许可证):
http://www.codeproject.com/KB/miscctrl/gridctrl.aspx
(或通过“MFC Grid Control”进行谷歌搜索)或者类似的东西,我认为会有更多的免费网格。)
It's not a noobish question. Actually you have encountered a problem which bugs every MFC developer since 15 years: The MFC library does not have a built-in Grid Control. And a kind of Grid Control is what you are looking for, I guess. As far as I'm aware of, it is not possible to edit two columns in a CListCtrl. Only the first column, the "Label", can be edited.
For a Grid control you have to look for appropriate Third-Party tools which can be added to your projects, for instance as ActiveX controls. (I remember that the old Visual Studio 6 came with an "MS FlexGrid" which you could add with the component gallery to the project, but I've never worked with it, so I don't know if it's a good choice. But perhaps enough for your purpose.) Most third-party Grid controls require license fees but here is one (quite powerful) grid for free (at least free of fees but not of a license):
http://www.codeproject.com/KB/miscctrl/gridctrl.aspx
(or google by "MFC Grid Control" or something like that. I think there will be more free grids.)