コード例 #1
0
        private void tsbGridView_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo info = e.Info as DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo;
            DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
            string s = "";

            foreach (DevExpress.XtraGrid.GridGroupSummaryItem g in view.GroupSummary)
            {
                if (g.ShowInGroupColumnFooter == null)
                {
                    if (s != string.Empty)
                    {
                        s += " ";
                    }
                    s += view.GetGroupSummaryDisplayText(e.RowHandle, g);
                }
            }
            //var aaa = view.GetGroupSummaryValues(e.RowHandle).Values;
            //decimal gCnt = Convert.ToDecimal(view.GetChildRowCount(e.RowHandle));
            int     c    = 0;
            decimal gCnt = Convert.ToDecimal(getChildRows(view, e.RowHandle, ref c));
            decimal tCnt = Convert.ToDecimal(tsbGridView.DataRowCount);

            //decimal tCnt = Convert.ToDecimal(colTSBID.SummaryItem.SummaryValue);
            if (tCnt != 0)
            {
                decimal pc = Math.Round(gCnt / tCnt * 100, 0);
                s += string.Format(" %{0}", pc);
            }

            info.GroupText = string.Format(view.GroupFormat, info.Column.Caption, info.GroupValueText, s);
        }
コード例 #2
0
        private void gridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo info = e.Info as DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo;
            DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
            string s = "";

            foreach (DevExpress.XtraGrid.GridGroupSummaryItem g in view.GroupSummary)
            {
                if (g.ShowInGroupColumnFooter == null)
                {
                    if (s != string.Empty)
                    {
                        s += " ";
                    }
                    s += view.GetGroupSummaryDisplayText(e.RowHandle, g);
                }
            }
            info.GroupText = string.Format(view.GroupFormat, info.Column.Caption, info.EditValue, s);
        }