private void DrawMergedCells(PaintExEventArgs e)
 {
     foreach (MyMergedCell cell in _MergedCells)
     {
         painter.DrawMergedCell(cell, e);
     }
 }
        private void grid_Paint(object sender, PaintExEventArgs e) // PaintEventArgs
        {
            if (DropTargetRowHandle < 0)
            {
                return;
            }
            GridControl  grid         = (GridControl)sender;
            GridView     view         = (GridView)grid.MainView;
            bool         isBottomLine = DropTargetRowHandle == view.DataRowCount;
            GridViewInfo viewInfo     = view.GetViewInfo() as GridViewInfo;
            GridRowInfo  rowInfo      = viewInfo.GetGridRowInfo(isBottomLine ? DropTargetRowHandle - 1 : DropTargetRowHandle);

            if (rowInfo == null)
            {
                return;
            }
            Point p1, p2;

            if (isBottomLine)
            {
                p1 = new Point(rowInfo.Bounds.Left, rowInfo.Bounds.Bottom - 1);
                p2 = new Point(rowInfo.Bounds.Right, rowInfo.Bounds.Bottom - 1);
            }
            else
            {
                p1 = new Point(rowInfo.Bounds.Left, rowInfo.Bounds.Top - 1);
                p2 = new Point(rowInfo.Bounds.Right, rowInfo.Bounds.Top - 1);
            }

            e.Cache.DrawLine(Pens.Blue, p1, p2);
            //e.Graphics.DrawLine(Pens.Blue, p1, p2);
        }
        private void DrawRegularBorder(PaintExEventArgs e)
        {
            Rectangle rect = GetSelectionBounds();

            e.Cache.DrawRectangle(e.Cache.GetPen(Color.Black, lineWidth), rect);
            if (GridView.GetSelectedCells().Length == 1)
            {
                DrawDragImage(e, rect);
            }
        }
 private void GridControl_PaintEx(object sender, PaintExEventArgs e)
 {
     if (IsCopyMode)
     {
         DrawCopyBorder(e);
     }
     else
     {
         DrawRegularBorder(e);
     }
 }
        private void GridControl_PaintEx(object sender, PaintExEventArgs e)
        {
            if (!string.IsNullOrEmpty(_View.ActiveFilterString))
            {
                return;
            }
            Rectangle bounds = GetAutoFilterRowBounds();

            if (e.ClipRectangle.IntersectsWith(bounds))
            {
                DrawAutoFilterRowText(_View, e.Cache, bounds);
            }
        }
        private void Grid_PaintEx(object sender, PaintExEventArgs e)
        {
            GridViewInfo vi          = view.GetViewInfo() as GridViewInfo;
            Pen          standardPen = e.Cache.GetPen(view.PaintAppearance.Row.BackColor);
            Pen          pen;
            Point        p1 = Point.Empty;
            Point        p2 = Point.Empty;

            if (Hide)
            {
                foreach (GridRowInfo ri in vi.RowsInfo)
                {
                    if (ri.IsGroupRow)
                    {
                        continue;
                    }
                    Pen p = standardPen;
                    if (ri.RowHandle == view.FocusedRowHandle)
                    {
                        pen = e.Cache.GetPen(view.PaintAppearance.FocusedRow.BackColor);
                    }
                    else
                    {
                        pen = standardPen;
                    }
                    foreach (GridColumn column in view.VisibleColumns)
                    {
                        if (!columnList.Contains(column))
                        {
                            continue;
                        }
                        p1 = new Point(vi.ColumnsInfo[column].Bounds.Right - 1, ri.Bounds.Y);
                        p2 = new Point(vi.ColumnsInfo[column].Bounds.Right - 1, ri.Bounds.Bottom - 2);
                        e.Cache.DrawLine(pen, p1, p2);
                    }
                }
            }
        }
        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;
        }
 private void DrawDragImage(PaintExEventArgs e, Rectangle rect)
 {
     e.Cache.FillRectangle(Brushes.Black, GetDragRect(rect));
 }
        private void DrawCopyBorder(PaintExEventArgs e)
        {
            Rectangle rect = GetSelectionBounds();

            Paint.DrawFocusRectangle(e.Cache.Graphics, rect, Color.Black, Color.White);
        }