public MyMergedCell RemoveMergedCell(int rowHandle, GridColumn col1, GridColumn col2) { MyMergedCell cell = new MyMergedCell(rowHandle, col1, col2); _MergedCells.Remove(cell); return(cell); }
public MyMergedCell AddMergedCell(int rowHandle, GridColumn col1, GridColumn col2) { MyMergedCell cell = new MyMergedCell(rowHandle, col1, col2); _MergedCells.Add(cell); return(cell); }
public void SafeSetMergedCellValue(MyMergedCell cell, object value) { if (cell != null) { SafeSetCellValue(cell.RowHandle, cell.Column1, value); SafeSetCellValue(cell.RowHandle, cell.Column2, value); } }
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) { 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) //yjkim modify { return; } Rectangle bounds = gridCellInfo1.ViewInfo.Bounds; //bounds.Location = new System.Drawing.Point(bounds.Location.X + 1, bounds.Location.Y + 1); bounds.Width = targetRect.Width - 2; bounds.Height = targetRect.Height - 2; 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;; }
public void DrawMergedCell(MyMergedCell cell, PaintExEventArgs 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) { 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; } Rectangle bounds = gridCellInfo1.ViewInfo.Bounds; bounds.Width = targetRect.Width; bounds.Height = targetRect.Height; gridCellInfo1.ViewInfo.Bounds = bounds; gridCellInfo1.ViewInfo.CalcViewInfo(e.Cache.Graphics); IsCustomPainting = true; gridCellInfo1.Appearance.FillRectangle(e.Cache, gridCellInfo1.Bounds); DrawRowCell(new GridViewDrawArgs(e.Cache, vi, vi.ViewRects.Bounds), gridCellInfo1); IsCustomPainting = false; }
public void AddMergedCell(int rowHandle, GridColumn col1, GridColumn col2, object value) { MyMergedCell cell = AddMergedCell(rowHandle, col1, col2); SafeSetMergedCellValue(cell, value); }