点击查看详细介绍

树列表Tree搜索功能函数代码 精华帖

nxopen 7年前 2637 3

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


//树列表Tree搜索功能代码,传入要被搜索的树控件tree、要被搜索的列columnID、和关键字,返回收到的Node集合int TreeSearchFun(Tree *tree, int columnID, string Keyword, vector<Node *> &returnNodes)
{
	string strlwrKeyword = string(strlwr((char *)Keyword.c_str()));  //字母转小写
	Node * theNode = tree->RootNode();
	while(theNode != NULL)
	{
		string strlwrNodeStr = string(strlwr((char *)theNode->GetColumnDisplayText(columnID).GetLocaleText()));
		if(strlwrNodeStr.find(strlwrKeyword) != string::npos) 
		{
			returnNodes.push_back(theNode);
		}
 		theNode = theNode->NextNode();
	}
 	return 0;
}


5

最新回复 (3)
  • slcy20 7年前
    1

    谢谢楼主分享 再接再厉

  • yy806942911 7年前
    2

    谢谢楼主分享 好好学习一下

  • lb676308480 7年前
    3

    来看看 ,必须是会员才能看到吗?

请登录后发表新帖