public bool DrawMergedCell(MyMergedCell cell, PaintEventArgs e)
        {
            //return true;
            int delta = cell.Column1.VisibleIndex - cell.Column2.VisibleIndex;
            if (Math.Abs(delta) > 1)
                return false;
            GridViewInfo vi = View.GetViewInfo() as GridViewInfo;

            GridCellInfo gridCellInfo1 = vi.GetGridCellInfo(cell.RowHandle, cell.Column1.VisibleIndex);
            GridCellInfo gridCellInfo2 = vi.GetGridCellInfo(cell.RowHandle, cell.Column2.VisibleIndex);
            if (gridCellInfo1 == null || gridCellInfo2 == null)
                return false;
            Rectangle targetRect = Rectangle.Union(gridCellInfo1.Bounds, gridCellInfo2.Bounds);
            gridCellInfo1.Bounds = targetRect;
            gridCellInfo1.CellValueRect = targetRect;
            gridCellInfo2.Bounds = targetRect;
            gridCellInfo2.CellValueRect = targetRect;
            if (delta < 0)
                gridCellInfo1 = gridCellInfo2;

            Rectangle bounds = gridCellInfo1.ViewInfo.Bounds;
            bounds.Width = targetRect.Width;
            bounds.Height = targetRect.Height;
            gridCellInfo1.ViewInfo.Bounds = bounds;
            gridCellInfo1.ViewInfo.CalcViewInfo(e.Graphics);
            IsCustomPainting = true;
            GraphicsCache cache = new GraphicsCache(e.Graphics);

            gridCellInfo1.Appearance.FillRectangle(cache, gridCellInfo1.Bounds);
            DrawRowCell(new GridViewDrawArgs(cache, vi, vi.ViewRects.Bounds), gridCellInfo1);
            IsCustomPainting = false;

            return true;
        }
Esempio n. 2
0
 public MyMergedCell AddMergedCell(int rowHandle, GridColumn col1, GridColumn col2)
 {
     MyMergedCell cell = new MyMergedCell(rowHandle, col1, col2);
     _MergedCells.Add(cell);
     return cell;
 }
Esempio n. 3
0
 public void SafeSetMergedCellValue(MyMergedCell cell, object value)
 {
     if (cell != null)
     {
         SafeSetMergedCellValue(cell.RowHandle, cell.Column1, value);
         SafeSetMergedCellValue(cell.RowHandle, cell.Column2, value);
     }
 }