本文主要是介绍LabWindows中Table控件的下拉列的设置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1 先看样式
2 样式设置,双击table,添加列以后,编辑列,选择 Combo box
3 全选一列,无法添加值,只有选中一个单元格才可以添加值
-------->>>------->>
4 行的隐藏,其实不是真的隐藏行,而是把对应行的字体颜色改为白色
//历史数据显示到表格
void displayDataTableDB()
{char tt[80];//把数据显示到表格SetCtrlAttribute(panelHandleDb,PANELdb_WxpDataTableDB,ATTR_DIMMED,1);for(int i=1; i<channelCount; i++){SetTableRowAttribute(panelHandleDb,PANELdb_WxpDataTableDB,i,ATTR_ROW_HEIGHT,30);SetTableCellVal(panelHandleDb,PANELdb_WxpDataTableDB,MakePoint(1,i),WxpAqurieData[i].w1NodeName);sprintf(tt,"%.2f",WxpAqurieData[i].w1WinSpeed);SetTableCellVal(panelHandleDb,PANELdb_WxpDataTableDB,MakePoint(2,i),tt);sprintf(tt,"%.2f",WxpAqurieData[i].w1EnvTemp);SetTableCellVal(panelHandleDb,PANELdb_WxpDataTableDB,MakePoint(3,i),tt);SetTableCellVal(panelHandleDb,PANELdb_WxpDataTableDB,MakePoint(5,i),WxpAqurieData[i].w2NodeName);sprintf(tt,"%.2f",WxpAqurieData[i].w2WinSpeed);SetTableCellVal(panelHandleDb,PANELdb_WxpDataTableDB,MakePoint(6,i),tt);sprintf(tt,"%.2f",WxpAqurieData[i].w2EnvTemp);SetTableCellVal(panelHandleDb,PANELdb_WxpDataTableDB,MakePoint(7,i),tt);//全部调整为黑色for(int k=1; k<8; k++)SetTableCellAttribute (panelHandleDb,PANELdb_WxpDataTableDB, MakePoint (k, i),ATTR_TEXT_COLOR, VAL_BLACK);//调节隔行颜色if(i%2==0)for(int k=1; k<8; k++)SetTableCellAttribute (panelHandleDb,PANELdb_WxpDataTableDB, MakePoint (k, i),ATTR_TEXT_COLOR, VAL_RED);//判定是否隐藏GetTableCellVal(panelHandleDb,PANELdb_WxpDataTableDB,MakePoint(9,i),tt);if(strcmp(tt,"隐藏")==0)for(int k=1; k<8; k++)SetTableCellAttribute (panelHandleDb,PANELdb_WxpDataTableDB, MakePoint (k, i),ATTR_TEXT_COLOR, VAL_WHITE);}SetTableSelection(panelHandleDb,PANELdb_WxpDataTableDB,MakeRect(20,1,1,7));SetCtrlAttribute(panelHandleDb,PANELdb_WxpDataTableDB,ATTR_DIMMED,0);
}
这里要强调一点,表格在插入数据涉及到控件刷新,速度会非常缓慢。
在插入数据前,使表格变灰dimmed=1,也就是 SetCtrlAttribute(panelHandleDb,PANELdb_WxpDataTableDB,ATTR_DIMMED,1);
插入完毕后,使表格有效 dimmed=0,也就是 SetCtrlAttribute(panelHandleDb,PANELdb_WxpDataTableDB,ATTR_DIMMED,0);
速度会非常快,界面刷新毫无压力。
这篇关于LabWindows中Table控件的下拉列的设置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!