Example #1
0
        void PrepareListOfMergedRows()
        {
            int          iMergeCellCount = 0;
            GridViewInfo vInfo           = gridView1.GetViewInfo() as GridViewInfo;

            int       UnCalculatedHeightScale = vInfo.RowsLoadInfo.VisibleRowCount / vInfo.RowsInfo.Count;
            Rectangle allBounds     = new Rectangle(vInfo.Bounds.X, vInfo.Bounds.Y, vInfo.Bounds.Width, vInfo.Bounds.Height * UnCalculatedHeightScale);
            Rectangle initialBounds = vInfo.Bounds;

            vInfo.Calc(gridControl1.CreateGraphics(), allBounds);
            for (int i = 0; i < vInfo.RowsInfo.Count; i++)
            {
                GridDataRowInfo rowInfo = vInfo.RowsInfo[i] as GridDataRowInfo;
                if (rowInfo != null)
                {
                    GridCellInfo cInfo = rowInfo.Cells[gridView1.Columns["ID"]];
                    if (!cInfo.IsMerged || cInfo.MergedCell.FirstCell == cInfo)
                    {
                        mergedRows.Add(i, iMergeCellCount - 1);
                    }
                    else
                    {
                        mergedRows.Add(i, iMergeCellCount);
                        iMergeCellCount++;
                    }
                    mergedRows[i]++;
                }
            }
            vInfo.Calc(gridControl1.CreateGraphics(), initialBounds);
        }
        void ShowGroupEdit()
        {
            TextEdit te = new TextEdit();

            this.View.GridControl.Controls.Add(te);
            rowToChangeHandle = this.View.FocusedRowHandle;
            GridViewInfo gvi = new GridViewInfo(this.View);
            Graphics     g   = this.View.GridControl.CreateGraphics();

            gvi.Calc(g, this.View.ViewRect);
            GridGroupRowInfo info    = gvi.RowsInfo.GetInfoByHandle(rowToChangeHandle) as GridGroupRowInfo;
            string           newText = this.View.GetGroupRowValue(rowToChangeHandle).ToString();

            te.Text    = newText;
            te.Bounds  = info.DataBounds;
            te.Visible = true;
            te.Focus();
            te.SelectAll();
            te.Leave   += new System.EventHandler(this.textEdit_Leave);
            te.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textEdit_KeyDown);
        }
Example #3
0
        private void Grid_Paint(object sender, PaintEventArgs e)
        {
            GridViewInfo vi = new GridViewInfo(View);

            vi.Calc(e.Graphics, Grid.Bounds);
            foreach (GridRowInfo row in vi.RowsInfo)
            {
                if (!row.IsGroupRow)
                {
                    if (!RowIcons.ContainsKey(row.RowHandle))
                    {
                        continue;
                    }
                    Rectangle rec    = row.Bounds;
                    int       groupX = row.Level * (row.DataBounds.X - row.Bounds.X) / (row.Level + 1);
                    rec.X     += groupX;
                    rec.Width -= row.DataBounds.Width;
                    rec.Width -= groupX;
                    e.Graphics.DrawIcon(RowIcons[row.RowHandle], rec);
                }
            }
        }