public static void DrawCombo(object sender, int column, int DrawColumn, int ChildViewLevel) { switch (sender.GetType().ToString().Substring(sender.GetType().ToString().LastIndexOf(".") + 1)) { case "SheetView": FarPoint.Win.Spread.SheetView o = sender as FarPoint.Win.Spread.SheetView; int i = 0; string tmp = "", curComboNo = ""; if (ChildViewLevel == 0) { for (i = 0; i < o.RowCount; i++) { #region "画" if (o.Cells[i, column].Text == "0") { o.Cells[i, column].Text = ""; } tmp = o.Cells[i, column].Text + ""; o.Cells[i, column].Tag = tmp; if (curComboNo != tmp && tmp != "") //是头 { curComboNo = tmp; o.Cells[i, DrawColumn].Text = "┓"; try { if (o.Cells[i - 1, DrawColumn].Text == "┃") { o.Cells[i - 1, DrawColumn].Text = "┛"; } else if (o.Cells[i - 1, DrawColumn].Text == "┓") { o.Cells[i - 1, DrawColumn].Text = ""; } } catch { } } else if (curComboNo == tmp && tmp != "") { o.Cells[i, DrawColumn].Text = "┃"; } else if (curComboNo != tmp && tmp == "") { try { if (o.Cells[i - 1, DrawColumn].Text == "┃") { o.Cells[i - 1, DrawColumn].Text = "┛"; } else if (o.Cells[i - 1, DrawColumn].Text == "┓") { o.Cells[i - 1, DrawColumn].Text = ""; } } catch { } o.Cells[i, DrawColumn].Text = ""; curComboNo = ""; } if (i == o.RowCount - 1 && o.Cells[i, DrawColumn].Text == "┃") { o.Cells[i, DrawColumn].Text = "┛"; } if (i == o.RowCount - 1 && o.Cells[i, DrawColumn].Text == "┓") { o.Cells[i, DrawColumn].Text = ""; } //o.Cells[i, DrawColumn].ForeColor = System.Drawing.Color.Red; #endregion } } else if (ChildViewLevel == 1) { for (int m = 0; m < o.RowCount; m++) { FarPoint.Win.Spread.SheetView c = o.GetChildView(m, 0); for (int j = 0; j < c.RowCount; j++) { #region "画" if (c.Cells[j, column].Text == "0") { c.Cells[j, column].Text = ""; } tmp = c.Cells[j, column].Text + ""; c.Cells[j, column].Tag = tmp; if (curComboNo != tmp && tmp != "") //是头 { curComboNo = tmp; c.Cells[j, DrawColumn].Text = "┓"; try { if (c.Cells[j - 1, DrawColumn].Text == "┃") { c.Cells[j - 1, DrawColumn].Text = "┛"; } else if (c.Cells[j - 1, DrawColumn].Text == "┓") { c.Cells[j - 1, DrawColumn].Text = ""; } } catch { } } else if (curComboNo == tmp && tmp != "") { c.Cells[j, DrawColumn].Text = "┃"; } else if (curComboNo != tmp && tmp == "") { try { if (c.Cells[j - 1, DrawColumn].Text == "┃") { c.Cells[j - 1, DrawColumn].Text = "┛"; } else if (c.Cells[j - 1, DrawColumn].Text == "┓") { c.Cells[j - 1, DrawColumn].Text = ""; } } catch { } c.Cells[j, DrawColumn].Text = ""; curComboNo = ""; } if (j == c.RowCount - 1 && c.Cells[j, DrawColumn].Text == "┃") { c.Cells[j, DrawColumn].Text = "┛"; } if (j == c.RowCount - 1 && c.Cells[j, DrawColumn].Text == "┓") { c.Cells[j, DrawColumn].Text = ""; } //c.Cells[j, DrawColumn].ForeColor = System.Drawing.Color.Red; #endregion } } } break; case "NeuDataWindow": NeuDataWindow.Controls.NeuDataWindow obj = sender as NeuDataWindow.Controls.NeuDataWindow; if (obj.RowCount < 1) //如果没有医嘱返回 { return; } string curComboID = ""; string tmpComboID = obj.GetItemString(1, (short)column); for (i = 2; i <= obj.RowCount; i++) { curComboID = obj.GetItemString(i, (short)column); if (tmpComboID == curComboID) { //组合号相等,如果上一个没有标志说明是组合的第一个 if (obj.IsItemNull(i - 1, (short)DrawColumn)) { //组合第一个赋值 obj.SetItemSqlString(i - 1, (short)DrawColumn, "┓"); //如果是最后一行 if (i == obj.RowCount) { obj.SetItemString(i, (short)DrawColumn, "┛"); } else { obj.SetItemString(i, (short)DrawColumn, "┃"); //这里不管是否是一组最后一个,最后一个在组合号不等时才设置 } } else { //如果是最后一行 if (i == obj.RowCount) { obj.SetItemString(i, (short)DrawColumn, "┛"); } else { obj.SetItemString(i, (short)DrawColumn, "┃"); } } } else { //组合号不等,这时会改变在组合号相等时设置的"┃"或者"┓",为"┛" if (!obj.IsItemNull(i - 1, (short)DrawColumn)) { //设置一组的最后一个符合 if (obj.GetItemString(i - 1, (short)DrawColumn) == "┃" || obj.GetItemString(i - 1, (short)DrawColumn) == "┓") { obj.SetItemString(i - 1, (short)DrawColumn, "┛"); } } } tmpComboID = curComboID; } break; } }
/// <summary> /// 括号在左边 /// </summary> /// <param name="sender"></param> /// <param name="column"></param> /// <param name="DrawColumn"></param> /// <param name="ChildViewLevel"></param> public static void DrawComboLeft(object sender, int column, int DrawColumn, int ChildViewLevel) { switch (sender.GetType().ToString().Substring(sender.GetType().ToString().LastIndexOf(".") + 1)) { case "SheetView": FarPoint.Win.Spread.SheetView o = sender as FarPoint.Win.Spread.SheetView; int i = 0; string tmp = "", curComboNo = ""; if (ChildViewLevel == 0) { for (i = 0; i < o.RowCount; i++) { #region "画" if (o.Cells[i, column].Text == "0") { o.Cells[i, column].Text = ""; } tmp = o.Cells[i, column].Text + ""; o.Cells[i, column].Tag = tmp; if (curComboNo != tmp && tmp != "") //是头 { curComboNo = tmp; o.Cells[i, DrawColumn].Text = "┏"; try { if (o.Cells[i - 1, DrawColumn].Text == "┃") { o.Cells[i - 1, DrawColumn].Text = "┗"; } else if (o.Cells[i - 1, DrawColumn].Text == "┏") { o.Cells[i - 1, DrawColumn].Text = ""; } } catch { } } else if (curComboNo == tmp && tmp != "") { o.Cells[i, DrawColumn].Text = "┃"; } else if (curComboNo != tmp && tmp == "") { try { if (o.Cells[i - 1, DrawColumn].Text == "┃") { o.Cells[i - 1, DrawColumn].Text = "┗"; } else if (o.Cells[i - 1, DrawColumn].Text == "┏") { o.Cells[i - 1, DrawColumn].Text = ""; } } catch { } o.Cells[i, DrawColumn].Text = ""; curComboNo = ""; } if (i == o.RowCount - 1 && o.Cells[i, DrawColumn].Text == "┃") { o.Cells[i, DrawColumn].Text = "┗"; } if (i == o.RowCount - 1 && o.Cells[i, DrawColumn].Text == "┏") { o.Cells[i, DrawColumn].Text = ""; } o.Cells[i, DrawColumn].ForeColor = System.Drawing.Color.Red; #endregion } } else if (ChildViewLevel == 1) { for (int m = 0; m < o.RowCount; m++) { FarPoint.Win.Spread.SheetView c = o.GetChildView(m, 0); for (int j = 0; j < c.RowCount; j++) { #region "画" if (c.Cells[j, column].Text == "0") { c.Cells[j, column].Text = ""; } tmp = c.Cells[j, column].Text + ""; c.Cells[j, column].Tag = tmp; if (curComboNo != tmp && tmp != "") //是头 { curComboNo = tmp; c.Cells[j, DrawColumn].Text = "┏"; try { if (c.Cells[j - 1, DrawColumn].Text == "┃") { c.Cells[j - 1, DrawColumn].Text = "┗"; } else if (c.Cells[j - 1, DrawColumn].Text == "┏") { c.Cells[j - 1, DrawColumn].Text = ""; } } catch { } } else if (curComboNo == tmp && tmp != "") { c.Cells[j, DrawColumn].Text = "┃"; } else if (curComboNo != tmp && tmp == "") { try { if (c.Cells[j - 1, DrawColumn].Text == "┃") { c.Cells[j - 1, DrawColumn].Text = "┗"; } else if (c.Cells[j - 1, DrawColumn].Text == "┏") { c.Cells[j - 1, DrawColumn].Text = ""; } } catch { } c.Cells[j, DrawColumn].Text = ""; curComboNo = ""; } if (j == c.RowCount - 1 && c.Cells[j, DrawColumn].Text == "┃") { c.Cells[j, DrawColumn].Text = "┗"; } if (j == c.RowCount - 1 && c.Cells[j, DrawColumn].Text == "┏") { c.Cells[j, DrawColumn].Text = ""; } c.Cells[j, DrawColumn].ForeColor = System.Drawing.Color.Red; #endregion } } } break; } }