public DataGridViewGroupColumn() { CellTemplate = new DataGridViewGroupCell(); (CellTemplate as DataGridViewGroupCell).Ontxtchange += new DataGridViewGroupCell.Txtchange(DataGridViewGroupColumn_Ontxtchange); (CellTemplate as DataGridViewGroupCell).Serchtb = Serchtb; ReadOnly = true; }
private void 折叠ToolStripMenuItem_Click(object sender, EventArgs e) { for (int i = 0; i < this.Dgvpathinfo.Rows.Count; i++) { DataGridViewGroupCell cel = this.Dgvpathinfo.Rows[i].Cells[this.Dgvpathinfo.groupColumIndex] as DataGridViewGroupCell; cel.Collapse(); } }
/// <summary> /// 该节点是否与下一个节点同级 /// </summary> /// <returns></returns> private bool IsNextLevSame() { int row = DataGridView.Rows.GetNextRow(RowIndex, DataGridViewElementStates.None); if (row == -1) { return(false); } DataGridViewGroupCell cel = DataGridView.Rows[row].Cells[Index] as DataGridViewGroupCell; return(cel.GroupLevel == this.GroupLevel); }
/// <summary> /// 该节点是否为某一级节点的最后一个子结点 /// </summary> /// <param name="level">节点层级</param> /// <returns></returns> private bool IsLastCell(int level) { int row = DataGridView.Rows.GetNextRow(RowIndex, DataGridViewElementStates.None); if (row == -1) { return(true); } DataGridViewGroupCell cel = DataGridView.Rows[row].Cells[Index] as DataGridViewGroupCell; return(cel.GroupLevel == level); }
private void FrmCpTj_Load(object sender, EventArgs e) { // pathinfotb = PublicFunction.GetPathway(0); //this.Text = Iscp == 0 ? "引入路径" : "引入单病种"; //groupBox1.Text = Iscp == 0 ? "可选路径" : "可选单病种"; //this.btninto.Text = Iscp == 0 ? "进入路径" : "进入单病种"; //this.dgvdisease.AutoGenerateColumns = false; //this.dgvRule.AutoGenerateColumns = false; //初始化dgv string[] Columname = new string[] { (0 == 0 ? "路径名称" : "单病种"), "版本", "费用", "天数", "版本说明", "创建日期", "修改日期" }; string[] Values = new string[] { "fname", "VERSION", "fy", "ts", "VERSION_NOTE", "CREATE_DATE", "UPDATE_DATE" }; int[] colwidth = new int[] { 180, 40, 80, 80, 80, 120, 120 }; bool[] readonly1 = new bool[] { true, true, true, true, true, true }; string[] Coltype = new string[] { PublicFunction.DgvColStype.GroupColumn , PublicFunction.DgvColStype.TextBoxColumn, PublicFunction.DgvColStype.TextBoxColumn, PublicFunction.DgvColStype.TextBoxColumn , PublicFunction.DgvColStype.TextBoxColumn, PublicFunction.DgvColStype.TextBoxColumn, PublicFunction.DgvColStype.TextBoxColumn }; PublicFunction.InitDgv(Columname, colwidth, Coltype, Values, this.Dgvpathinfo, 1); this.Dgvpathinfo.AutoGenerateColumns = false; this.Dgvpathinfo.DataSource = pathinfotb; PublicFunction.GruopShow(pathinfotb, "fname=bname", "Bname", this.Dgvpathinfo, "PATHWAY_NAME", this.Dgvpathinfo.groupColumIndex, this.Dgvpathinfo.Iszlfb); for (int i = 0; i < pathinfotb.Rows.Count; i++) { if (pathinfotb.Rows[i]["PATHWAY_ID"].ToString().Trim() == "") { pathinfotb.Rows[i]["fname"] = (0 == 0 ? "路径:" : "单病种:") + pathinfotb.Rows[i]["bname"].ToString() + " 总共" + pathinfotb.Rows[i]["gs"].ToString() + "条"; } } if (Dgvpathinfo.RowCount > 0) { DataGridViewGroupCell childcell1 = Dgvpathinfo.Rows[0].Cells[0] as DataGridViewGroupCell; DataGridViewGroupCell childcell2 = Dgvpathinfo.Rows[1].Cells[0] as DataGridViewGroupCell; childcell1.AddChildCell(childcell2); } //patientinfotb = FrmMdiMain.Database.GetDataTable("select * from VI_ZY_VINPATIENT_ALL where inpatient_id='" + _inpatient_id + "' and baby_id=0"); // PublicFunction.GruopShow(pathinfotb, "fname=bname", "Bname", this.Dgvpathinfo, "PATHWAY_NAME", this.Dgvpathinfo.groupColumIndex, this.Dgvpathinfo.Iszlfb); }
/// <summary> /// 添加子结点 /// </summary> /// <param name="cell"></param> /// <returns></returns> public int AddChildCell(DataGridViewGroupCell cell) { return(AddChildCellRange(new DataGridViewGroupCell[] { cell })); }