头文件

#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. svn: 命令行上传多个指定文件

    上传指定后缀名文件 svn st | grep swift | cut -d' ' -f8- > targets.txt svn ci -m "comments" --tar ...

  2. ssh连接失败

    参考:http://www.cnblogs.com/starof/p/4709805.html https://www.chenyudong.com/archives/ssh-using-privat ...

  3. dhtmlx中添加一列(将相似button、下拉列表、输入框显示在一行上)

    { type: "label", list: [ { { type: "label", labelWidth: 55 }, { type: "newc ...

  4. R语言学习笔记-Error in ts(x):对象不是矩阵问题解决

    1.问题 在对时间序列进行拟合操作时,发生:Error in ts(x):对象不是矩阵的错误,而直接在arima()函数中使用时没有问题的. > sample<-c2 > sampl ...

  5. LeetCode 350. Intersection of Two Arrays II (两个数组的相交之二)

    Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1] ...

  6. 汉澳Sinox2014X64server高级桌面服务器版操作系统公布

    汉澳Sinox2014X64server高级桌面服务器版操作系统公布   当你在现代城市夜空中看到一道闪电.屏幕中央闪过几个图形,转眼间变成美轮美奂的紫色空中天国,说明你来到了汉澳sinox2014世 ...

  7. vim插件ctags的安装和使用【转】

    本文转载自:http://blog.csdn.net/g_brightboy/article/details/16830395 [ctags功能]: 为源码的变量/对象.结构体/类.函数/接口.宏等产 ...

  8. 洛谷 P4149 [ IOI 2011 ] Race —— 点分治

    题目:https://www.luogu.org/problemnew/show/P4149 仍然是点分治: 不过因为是取 min ,所以不能用容斥,那么子树之间就必须分开算,记录桶时注意这个: 每次 ...

  9. 用回调函数创建一个XMLHttpRequest,并从一个TXT文件中检索数据。

    <script> var xmlhttp; function loadXMLDoc(url,soyo) { if (window.XMLHttpRequest) {// IE7+, Fir ...

  10. SQL Server 数据字典生成脚本

    SELECT sysobjects.name AS 表名称 ,--sysproperties.[value] AS 表说明 ,syscolumns.name AS 字段名称 ,--properties ...