private int GetColumnBestHeight(GridBand column, int width, DevExpress.Utils.AppearanceObject app)
        {
            GridBandInfoArgs   ex       = null;
            BandedGridViewInfo viewInfo = GridView.GetViewInfo() as BandedGridViewInfo;

            viewInfo.GInfo.AddGraphics(null);
            ex = new GridBandInfoArgs(null, viewInfo.GInfo.Cache);
            try
            {
                ex.InnerElements.Add(new DrawElementInfo(new GlyphElementPainter(),
                                                         new GlyphElementInfoArgs(viewInfo.View.Images, 0, null),
                                                         StringAlignment.Near));
                ex.SetAppearance(app);
                ex.Caption     = column.Caption;
                ex.CaptionRect = new Rectangle(0, 0, (int)(width - 10 * DpiXRel), 1000);
            }
            finally
            {
                viewInfo.GInfo.ReleaseGraphics();
            }

            GraphicsInfo grInfo = new GraphicsInfo();

            grInfo.AddGraphics(null);
            ex.Cache = grInfo.Cache;
            int Height = CalcCaptionTextSize(grInfo.Cache, ex as HeaderObjectInfoArgs, column.Caption);

            return(Height);
        }
Esempio n. 2
0
        private int GetColumnBestHeight(GridBand column, int width /*, GridBand parent_column*/)
        {
            /*GridBandInfoArgs ex = null;
             *
             * if (parent_column == null)
             *  ex = viewInfo.BandsInfo[column];
             * else
             *  ex = viewInfo.BandsInfo[parent_column].Children[column];
             *
             * GraphicsInfo grInfo = new GraphicsInfo();
             * grInfo.AddGraphics(null);
             * ex.Cache = grInfo.Cache;
             * bool canDrawMore = true;
             * Size captionSize = CalcCaptionTextSize(grInfo.Cache, ex as HeaderObjectInfoArgs, column.Caption);
             * Size res = ex.InnerElements.CalcMinSize(grInfo.Graphics, ref canDrawMore);
             * res.Height = Math.Max(res.Height, captionSize.Height);
             * res.Width += captionSize.Width;
             * //res = viewInfo.Painter.ElementsPainter.Column.CalcBoundsByClientRectangle(ex, new Rectangle(Point.Empty, res)).Size;
             * grInfo.ReleaseGraphics();
             * return res.Height;*/

            GridBandInfoArgs   ex       = null;
            BandedGridViewInfo viewInfo = GridView.GetViewInfo() as BandedGridViewInfo;

            viewInfo.GInfo.AddGraphics(null);
            ex = new GridBandInfoArgs(null, viewInfo.GInfo.Cache);
            try
            {
                ex.InnerElements.Add(new DrawElementInfo(new GlyphElementPainter(),
                                                         new GlyphElementInfoArgs(viewInfo.View.Images, 0, null),
                                                         StringAlignment.Near));
                ex.SetAppearance(GridView.Appearance.BandPanel);
                ex.Caption     = column.Caption;
                ex.CaptionRect = new Rectangle(0, 0, width, 1000);
            }
            finally
            {
                viewInfo.GInfo.ReleaseGraphics();
            }

            GraphicsInfo grInfo = new GraphicsInfo();

            grInfo.AddGraphics(null);
            ex.Cache = grInfo.Cache;
            Size captionSize = CalcCaptionTextSize(grInfo.Cache, ex as HeaderObjectInfoArgs, column.Caption);

            return(captionSize.Height);
        }