头文件

#pragma once
#include "D:\Work\山东项目\StandardizedDrawing\sdUtils\CSGrid.h"
#include "ZwLResources.h"
class CPaneGrid :
public CSGrid
{
public:
CPaneGrid(void);
~CPaneGrid(void);
protected:
DECLARE_MESSAGE_MAP()
protected:
virtual VOID OnCellComboString(CSGridCell&cell, CComboBox&combo);
// virtual VOID OnRClickRow(CSGridRow&row, CPoint point);
// virtual VOID OnRClickCol(CSGridCol&col, CPoint pt);
// virtual BOOL OnRowSelectChange(int nOldRow, int &nNewRow);
};

cpp文件

#include "StdAfx.h"
#include "PaneGrid.h"
#include "OdbcDatabase.h"
#include "GlobalArxUtils.h"
#include "GlobalUtils.h"
#include "CSGrid.h"

CPaneGrid::CPaneGrid() :CSGrid(FALSE)
{
AppendColumn(_T("属性名称"), 70);
AppendColumn(_T("值"), 120);
GetCol(GetColumnCount() - 1).SetComboEdit(TRUE);
}
BEGIN_MESSAGE_MAP(CPaneGrid, CSGrid)
END_MESSAGE_MAP()
CPaneGrid::~CPaneGrid(void)
{
}
VOID CPaneGrid::OnCellComboString(CSGridCell&cell, CComboBox&combo)
{
long lIndexRow = cell.GetRowIndex();
long lIndexCol = cell.GetColIndex();
CSGridCell cellNmae=CSGrid::GetCell(lIndexRow, lIndexCol-1);
CString ProName=cellNmae.GetText();
CString sDatabase;
sDatabase.Format(_T("%sData\\%s"), GetAppRoot(), SDDATABASE);
COdbcDatabase db;
CString sQuery;
CStringList slResults;
CString sValue;
if (db.InitializeWithPath(sDatabase))
{
sQuery.Format(
_T("SELECT AlternativeValue FROM ")
_T("%s ") _T("WHERE [PropertyName] = '%s'"),
TABLE_CUSTOMPROPERTY, ProName);
slResults.RemoveAll();
db.GetQuery(sQuery, slResults);
}
POSITION rPos;
rPos = slResults.GetHeadPosition();
while (rPos != NULL)
{
sValue = slResults.GetNext(rPos);
//拆分字符串
CStringArray saCf;
int iPos = -1;
while ((iPos = sValue.Find(',')) != -1)
{
saCf.Add(sValue.Left(iPos));
sValue.Delete(0, iPos + 1);
}
saCf.Add(sValue);
int iNum=saCf.GetCount();
for (int i = 0; i < iNum;i++)
{
combo.AddString(saCf.GetAt(i));
}
}
return CSGrid::OnCellComboString(cell, combo);
}

重定义csgrid 然后用新定义的类去创建函数

listcontrol 加combobox实现的更多相关文章

  1. listcontrol 加combobox

    之前写过一篇(list Control实现单元格编辑)文章,那篇文章不是很完善执行的时候有时会出错,这篇文章经过完善后还加入了Combo Box功能! 这里我就只是晒一下我的代码; 头文件: // L ...

  2. ExtJs基础知识总结:自定义弹窗和ComboBox自动联想加载(四)

    概述 Extjs弹窗可以分为消息弹窗.对话框,这些弹窗的方式ExtJs自带的Ext.Msg.alert就已经可以满足简单消息提示,但是相对复杂的提示,比如如何将Ext.grid.Panel的控件显示嵌 ...

  3. 加载ComboBox控件

    /// <summary> /// 加载公司 /// </summary> /// <param name="cbbCompany">Combo ...

  4. extjs Combobox动态加载数据问题,mode:local 还是remote

    var fabircTypeDs = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'province.do' }), reade ...

  5. combobox远程加载数据的总结和Json数据的小结

    1.从后台返回请求加载Combobox下拉框数据 html部分1 <select name="mateBelongZ" id="mateBelongZID" ...

  6. easyui combobox 动态加载数据C#

    <script type="text/javascript" src="Scripts/jquery-1.8.2.min.js"></scri ...

  7. easyui combobox 动态加载的两种方法

    reload 方法 javascript代码 //指定id 和 text 否则始终选择第一个 $('#contact_city').combobox({ valueField:'id', textFi ...

  8. easyui combobox 动态加载数组数据

    怕自己忘了,记录下来以后用方便 html部分 <input id="rzcode" name="businesItemId" style="wi ...

  9. ExtJS ComboBox同时加载远程和本地数据

    ExtJS ComboBox同时加载远程和本地数据 原文:http://gblog.hbcf.net/index.php/archives/233 ComboBox比较特殊需求,将远程数据和本地数据同 ...

随机推荐

  1. Redhat 6.1安装ArcGIS Server10.1

    http://blog.csdn.net/linghe301/article/details/7762985 操作环境:Redhat 6.1 Linux 安装ArcGIS Server10.1之前,还 ...

  2. python-pexpect_02ssh

    #!/usr/bin/env python """ This runs a command on a remote host using SSH. At the prom ...

  3. 读写Word的组件DocX介绍与入门

    本文为转载内容: 文章原地址:http://www.cnblogs.com/asxinyu/archive/2013/02/22/2921861.html 开源Word读写组件DocX介绍与入门 阅读 ...

  4. LeetCode 706. Design HashMap (设计哈希映射)

    题目标签:HashMap 题目让我们设计一个 hashmap, 有put, get, remove 功能. 建立一个 int array, index 是key, 值是 value,具体看code. ...

  5. Netlink通信机制【转】

    本文转载自:http://www.cnblogs.com/wenqiang/p/6306727.html 一.什么是Netlink通信机制  Netlink套接字是用以实现用户进程与内核进程通信的一种 ...

  6. js如何获取某id的子标签

    思路:根据id获取父对象,然后使用childNodes获取所有子对象数组,关键代码: document.getElementById(div_id).childNodes;   // 子对象数组 实例 ...

  7. CodeForces - 557D Vitaly and Cycle(二分图)

    Vitaly and Cycle time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  8. 48.EXt.Data.JsonReader()

    转自:https://blog.csdn.net/huoyanxueren/article/details/2662915?utm_source=blogxgwz6 extJs 2.1学习笔记(Ext ...

  9. PCB InCAM 获取 JOB STEP 实现外挂脚本调试功能实现

    PCB CAM自动化基于Incam 打造,在测试时经常遇到调试障碍,每次自行对功能测试时,生成了exe脚本后,再到Incam里面运行,发现问题,再回来修改代码,非常不爽, 参考Genesis调试运行模 ...

  10. 在网页上打印,js window.print

    window.print默认会打印出当前页在屏幕中显示的部分,可以实现在线打印