protected override void DrawText(DevExpress.Utils.Drawing.GraphicsCache cache) { if (Text == null || Text.Length == 0 || TextBounds.IsEmpty) { return; } AppearanceObject appearance = new AppearanceObject(GetDefaultAppearance()); cache.Graphics.DrawImage(Image, TextBounds); Rectangle textRect = new Rectangle(TextBounds.X + x, TextBounds.Y, TextBounds.Width - x, TextBounds.Height); DrawTextShadow(cache, appearance, textRect); cache.Graphics.DrawString(Text, appearance.Font, Brushes.WhiteSmoke, textRect, new StringFormat(StringFormatFlags.NoWrap)); }
public Bitmap GetRowDragBitmap(int rowHandle) { Bitmap bmpView = null; Bitmap bmpRow = null; GridViewInfo info = _view.GetViewInfo() as GridViewInfo; Rectangle totalBounds = info.Bounds; GridRowInfo ri = info.GetGridRowInfo(rowHandle); Rectangle imageBounds = new Rectangle(new Point(0, 0), ri.Bounds.Size); try { bmpView = new Bitmap(totalBounds.Width, totalBounds.Height); using (Graphics gView = Graphics.FromImage(bmpView)) { using (XtraBufferedGraphics grView = XtraBufferedGraphicsManager.Current.Allocate(gView, new Rectangle(Point.Empty, bmpView.Size))) { Color color = ri.Appearance.BackColor == Color.Transparent ? Color.White : ri.Appearance.BackColor; grView.Graphics.Clear(color); IntPtr handle = View.GridControl.Handle; DXPaintEventArgs paintArgs = new DXPaintEventArgs(new PaintEventArgs(grView.Graphics, totalBounds), handle); DevExpress.Utils.Drawing.GraphicsCache cache = new DevExpress.Utils.Drawing.GraphicsCache(paintArgs); GridViewDrawArgs args = new GridViewDrawArgs(cache, info, totalBounds); DrawRow(args, ri); grView.Graphics.FillRectangle(args.Cache.GetSolidBrush(Color.Transparent), ri.Bounds); grView.Render(); bmpRow = new Bitmap(ri.Bounds.Width, ri.Bounds.Height); using (Graphics gRow = Graphics.FromImage(bmpRow)) { using (XtraBufferedGraphics grRow = XtraBufferedGraphicsManager.Current.Allocate(gRow, new Rectangle(Point.Empty, bmpRow.Size))) { grRow.Graphics.Clear(color); grRow.Graphics.DrawImage(bmpView, imageBounds, ri.Bounds, GraphicsUnit.Pixel); grRow.Render(); } } } } } catch { } return(bmpRow); }