コード例 #1
0
        /// <summary>
        /// Draws the column header.
        /// </summary>
        /// <param name="cache">The cache.</param>
        /// <param name="column">The column.</param>
        public void DrawColumnHeader(GraphicsCache cache, GridColumn column)
        {
            var viewInfo = _gridView.GetViewInfo() as BandedGridViewInfo;

            if (viewInfo != null)
            {
                GridColumnInfoArgs colInfo = viewInfo.ColumnsInfo[column];
                var bandedGridColumn       = column as BandedGridColumn;
                if (bandedGridColumn != null)
                {
                    GridBandInfoArgs bandInfo = getBandInfo(viewInfo.BandsInfo, bandedGridColumn.OwnerBand);
                    if (colInfo == null || bandInfo == null)
                    {
                        return;
                    }
                    colInfo.Cache = cache;

                    int       top   = bandInfo.Bounds.Top;
                    Rectangle rect  = colInfo.Bounds;
                    int       delta = rect.Top - top;
                    rect.Y         = top;
                    rect.Height   += delta;
                    colInfo.Bounds = rect;
                }
                colInfo.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
                ElementsPainter.Column.CalcObjectBounds(colInfo);
                ElementsPainter.Column.DrawObject(colInfo);
            }
        }
コード例 #2
0
        public static void DoDefaultDrawCell(BandedGridView view, RowCellCustomDrawEventArgs e)
        {
            PropertyInfo              pi;
            GridControl               grid;
            BandedGridViewInfo        info;
            GridCellInfo              cell;
            GridEditorContainerHelper helper;
            BandedGridViewDrawArgs    args;

            info = view.GetViewInfo() as BandedGridViewInfo;
            cell = e.Cell as GridCellInfo;
            grid = view.GridControl;

            //This line Returns Null with the overrridden Grid. Otherwise it works fine with the normal gridcontrol and gridView.
            pi     = grid.GetType().GetProperty("EditorHelper", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
            helper = pi.GetValue(grid, null) as GridEditorContainerHelper;
            args   = new BandedGridViewDrawArgs(e.Cache, info, e.Bounds);
            e.Appearance.FillRectangle(e.Cache, e.Bounds);
            helper.DrawCellEdit(args, cell.Editor, cell.ViewInfo, e.Appearance, cell.CellValueRect.Location);
        }