예제 #1
0
        public MyMergedCell AddMergedCell(int rowHandle, GridColumn col1, GridColumn col2)
        {
            MyMergedCell cell = new MyMergedCell(rowHandle, col1, col2);

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

            SafeSetMergedCellValue(cell, value);
        }
예제 #4
0
        public void AddMergedCell(int rowHandle, int col1, int col2, object value)
        {
            MyMergedCell cell = AddMergedCell(rowHandle, _view.Columns[col1], _view.Columns[col2]);

            SafeSetMergedCellValue(cell, value);
        }
예제 #5
0
        public void DrawMergedCell(MyMergedCell cell, PaintEventArgs e)
        {
            int delta = cell.Column1.VisibleIndex - cell.Column2.VisibleIndex;

            if (Math.Abs(delta) > 1)
            {
                return;
            }
            GridViewInfo vi            = View.GetViewInfo() as GridViewInfo;
            GridCellInfo gridCellInfo1 = vi.GetGridCellInfo(cell.RowHandle, cell.Column1);
            GridCellInfo gridCellInfo2 = vi.GetGridCellInfo(cell.RowHandle, cell.Column2);

            if (gridCellInfo1 != null && gridCellInfo2 == null)
            {
                gridCellInfo2 = gridCellInfo1;
            }
            if (gridCellInfo1 == null || gridCellInfo2 == null)
            {
                return;
            }
            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;
            }
            if (gridCellInfo1.ViewInfo == null)
            {
                return;
            }
            int       prevX  = gridCellInfo1.Bounds.X;
            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);
            int           width = gridCellInfo1.Bounds.Width;

            if (gridCellInfo1.Bounds.Right >= vi.View.GridControl.Width)
            {
                width -= gridCellInfo1.Bounds.Right - vi.View.GridControl.Width + 2;
            }

            int cellX        = 0;
            int columnIndent = vi.ColumnsInfo[0].Type == GridColumnInfoType.Indicator ? vi.ColumnsInfo[0].Bounds.Right : vi.ColumnsInfo[0].Bounds.X;

            cellX = Math.Max(gridCellInfo1.Bounds.X, columnIndent);
            if (vi.View.OptionsView.ShowIndicator && gridCellInfo1.Bounds.X < vi.ViewRects.IndicatorWidth)
            {
                width += gridCellInfo1.Bounds.X - vi.ViewRects.IndicatorWidth - 1;
            }
            gridCellInfo1.Bounds = new Rectangle(cellX, gridCellInfo1.Bounds.Y, width, gridCellInfo1.Bounds.Height);

            gridCellInfo1.Appearance.FillRectangle(cache, gridCellInfo1.Bounds);
            gridCellInfo1.CellValueRect.Location = new Point(gridCellInfo1.CellValueRect.Location.X + gridCellInfo1.Bounds.X - prevX, gridCellInfo1.CellValueRect.Location.Y);
            DrawRowCell(new GridViewDrawArgs(cache, vi, vi.ViewRects.Bounds), gridCellInfo1);
            IsCustomPainting = false;;
        }