/// <summary> /// create the stripColumnList and tofdColumnList for each showSession /// </summary> private void updateStripMap() { cleanSet();//clean all the controls before update the stripMap //int totalnum = showSessionList.Count; int totalnum = caltotalnum(); if (totalnum == 0) { return; } //System.Windows.Forms.Panel showPanel = splitContainer1.Panel1; float totalwidth = showPanel.Width; float scaleWidth = 30f; totalwidth -= scaleWidth; float subpanelwidth = totalwidth / totalnum; float curPos = 0; scaleColumn = new calibStripColumn(showPanel, curPos, scaleWidth, null, calibStripType.Scale); curPos += scaleWidth; for (int i = 0; i < totalnum; i++) { //RowData rowData = rowDatasList[i]; string assignName = showSessionList[i].myHardInfo.AssignedName; //SessionHardWare.getInfo(assignName, out upPort); calibStripType showtype = getShowType(assignName); if (showtype == calibStripType.PAstrip) { calibStripColumn newColumn = new calibStripColumn(showPanel, curPos, subpanelwidth, assignName, showtype); //stripColumnList newColumn = new stripColumnList(showPanel, rowData, curPos, subpanelwidth, MapType.Strip); stripColumnList.Add(newColumn); curPos += subpanelwidth; } else if (showtype == calibStripType.TOFDmap) { calibStripColumn newColumn = new calibStripColumn(showPanel, curPos, subpanelwidth, assignName, calibStripType.PAstrip); //PictureColumn pictureDatas = new PictureColumn(showPanel, rowData, curPos, subpanelwidth, PictureType.TOFD); stripColumnList.Add(newColumn); curPos += subpanelwidth; } } }
private void cleanSet() { showPanel.Controls.Clear(); if (scaleColumn != null) { scaleColumn.clearSets(); scaleColumn = null; } if (stripColumnList != null) { for (int i = stripColumnList.Count - 1; i >= 0; i--) { stripColumnList[i].clearSets(); //clean all child Controls if (stripColumnList[i] != null) { stripColumnList[i] = null; } stripColumnList.RemoveAt(i); } } if (tofdColumnList != null) { for (int i = tofdColumnList.Count - 1; i >= 0; i--) { tofdColumnList[i].clearSets(); //clean all child Controls if (tofdColumnList[i] != null) { tofdColumnList[i] = null; } tofdColumnList.RemoveAt(i); } } GC.Collect(); }