我想在多行中添加组合框和编辑控件,但在clistctrl中的单列内 [英] I want to add combo box and edit control in multiple rows but inside single column in clistctrl

查看:110
本文介绍了我想在多行中添加组合框和编辑控件,但在clistctrl中的单列内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索了解决方案,但它们适用于整个专栏,我希望将其用于特定行



我尝试了什么:



我在网上找到他们为整个专栏工作的解决方案

I searched for solutions but they work for the entire column, I wanted to get it for a particular row

What I have tried:

I got solutions online they worked for the entire column

推荐答案

泛型 CListCtrl 不支持具有嵌入式控件的列。如果您需要那些,您必须创建自己的 CListCtrl 基于类,支持您可能已经找到的解决方案。



但是这些列是明智的,因为这是这些列表的意图。如果只需要特定单元格的控件,则必须扩展这些解决方案。您必须创建嵌入式控件并将其窗口句柄或指针存储在另一个列表中。您还需要某种查找函数来返回特定行和列的句柄。该列表必须是自定义绘制(让嵌入式控件重绘而不是使用默认列表项绘图)并在几个鼠标和键盘事件上激活嵌入式控件(设置焦点)。



一个更简单的方法可能是使用叠加控件。这是在激活特定单元格时动态创建控件(例如,通过双击或通过上下文菜单)并将焦点设置为它们。完成编辑/选择后,可以更新列表单元格,删除临时控件,并将焦点返回到列表。但是使用这种方法,将不会显示提供选择或编辑的单元格。
The generic CListCtrl provides no support for columns with embedded controls. If you need those you have to create your own CListCtrl based class supporting that as provided by solutions you have probably found already.

But those are doing that column wise because that is the intention of such lists. If you want the controls for specific cells only, you have to extend those solutions. You have to create the embedded controls and store it's window handles or pointers in another list. You need also some kind of lookup function that returns those handles for a specific row and column. The list has to be custom draw (let the embedded control redraw itself instead of using the default list item drawing) and provide activation of the embedded controls (setting the focus) upon several mouse and keyboard events.

A simpler method might be using overlay controls. That is creating the controls dynamically when activating a specific cell (e.g. by double clicking or via context menu) and setting the focus to them. Once the edit / selection has been done, the list cell can be updated, the temporary control is deleted, and focus is returned back to the list. But with this method there will be no indication of cells that provide selection or edit.


这篇关于我想在多行中添加组合框和编辑控件,但在clistctrl中的单列内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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