protected override Rectangle CalcButtons(DevExpress.Utils.Drawing.GraphicsCache cache) { Rectangle result = base.CalcButtons(cache); CalcButtonsBoundsCore(this.LeftButtons); CalcButtonsBoundsCore(this.RightButtons); return(result); }
public int CalcHeight(DevExpress.Utils.Drawing.GraphicsCache cache, int width) { RepositoryItemMyButtonEdit ri = (Item as RepositoryItemMyButtonEdit); RichTextEditViewInfo vi = new RichTextEditViewInfo(ri.RichEdit); vi.EditValue = this.EditValue; return(vi.CalcHeight(width) + 6); }
public MyToolButtonDrawEventArgs(DevExpress.Utils.AppearanceObject appearance, MyToolButtonViewInfo viewInfo, DevExpress.Utils.Drawing.GraphicsCache cache) { this.appearance = appearance; this.viewInfo = viewInfo; this.cache = cache; }
protected override void DrawPanel(DevExpress.Utils.Drawing.GraphicsCache cache, DevExpress.Utils.Drawing.GroupObjectInfoArgs info) { //if ( this.Dock==DockStyle.Fill&&this.BorderStyle!=DevExpress.XtraEditors.Controls.BorderStyles.NoBorder ) //{ // this.BorderStyle=DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; // this.Margin=new Padding( 0 ); //} base.DrawPanel(cache, info); }
protected override void DrawContent(DevExpress.Utils.Drawing.GraphicsCache graphicsCache, DevExpress.Skins.Skin skin) { base.DrawContent(graphicsCache, skin); MyAlertInfo alertInfo = Owner.Info as MyAlertInfo; if (alertInfo != null) { Color backColor = alertInfo.BackColor; Rectangle rect = new Rectangle(Owner.ClientRectangle.Location, Owner.ClientRectangle.Size); rect.Inflate(-2, -2); using (SolidBrush brush = new SolidBrush(backColor)) graphicsCache.Graphics.FillRectangle(brush, rect); } }
public Cursor GetDragCursor(int rowHandle, Point e) { GridViewInfo info = _View.GetViewInfo() as GridViewInfo; GridRowInfo rowInfo = info.GetGridRowInfo(rowHandle); Rectangle imageBounds = new Rectangle(new Point(0, 0), rowInfo.TotalBounds.Size); Rectangle totalBounds = new Rectangle(new Point(0, 0), info.Bounds.Size); Bitmap bitmap = new Bitmap(totalBounds.Width, totalBounds.Height); //Grid Bitmap gridBitmap = new Bitmap(totalBounds.Width, totalBounds.Height); Rectangle rectBound = _View.GridControl.Bounds; rectBound.X = 0; rectBound.Y = 0; _View.GridControl.DrawToBitmap(gridBitmap, rectBound); DevExpress.Utils.Drawing.GraphicsCache cache = new DevExpress.Utils.Drawing.GraphicsCache(Graphics.FromImage(bitmap)); GridViewDrawArgs args = new GridViewDrawArgs(cache, info, totalBounds); DrawRow(args, rowInfo); Bitmap result = new Bitmap(imageBounds.Width, imageBounds.Height); Graphics resultGraphics = Graphics.FromImage(result); float[][] matrixItems = { new float[] { 1, 0, 0, 0, 0 }, new float[] { 0, 1, 0, 0, 0 }, new float[] { 0, 0, 1, 0, 0 }, new float[] { 0, 0, 0, 0.7f, 0 }, new float[] { 0, 0, 0, 0, 1 } }; ColorMatrix colorMatrix = new ColorMatrix(matrixItems); ImageAttributes imageAttributes = new ImageAttributes(); imageAttributes.SetColorMatrix( colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); resultGraphics.DrawImage(gridBitmap, imageBounds, rowInfo.TotalBounds.X, rowInfo.TotalBounds.Y, rowInfo.TotalBounds.Width, rowInfo.TotalBounds.Height, GraphicsUnit.Pixel, imageAttributes); Point offset = new Point(e.X - rowInfo.TotalBounds.X, e.Y - rowInfo.TotalBounds.Y); //result.Save("file" + DateTime.Now.Millisecond + ".bmp"); return(CreateCursor(result, offset)); }
protected override void DrawText(DevExpress.Utils.Drawing.GraphicsCache cache) { string text = Text; if (text == null || text.Length == 0 || TextBounds.IsEmpty) { return; } using (AppearanceObject appearance = new AppearanceObject(GetDefaultAppearance())) { appearance.TextOptions.Trimming = Trimming.EllipsisCharacter; appearance.TextOptions.HAlignment = HorzAlignment.Center; if (AllowHtmlDraw) { DrawHtmlText(cache, appearance); return; } Rectangle r = RectangleHelper.GetCenterBounds(TextBounds, new Size(TextBounds.Width, CalcTextHeight(cache.Graphics, appearance))); DrawTextShadow(cache, appearance, r); cache.DrawString(text, appearance.Font, appearance.GetForeBrush(cache), r, appearance.GetStringFormat()); } }
public Cursor GetDragRowCursor(int rowHandle, Point e) { GridViewInfo info = _View.GetViewInfo() as GridViewInfo; GridRowInfo rowInfo = info.GetGridRowInfo(rowHandle); if (rowInfo == null) { return(Cursor.Current); } Rectangle imageBounds = new Rectangle(new Point(0, 0), rowInfo.TotalBounds.Size); Rectangle totalBounds = new Rectangle(new Point(0, 0), info.Bounds.Size); Bitmap bitmap = new Bitmap(totalBounds.Width, totalBounds.Height); DevExpress.Utils.Drawing.GraphicsCache cache = new DevExpress.Utils.Drawing.GraphicsCache(Graphics.FromImage(bitmap)); GridViewDrawArgs args = new GridViewDrawArgs(cache, info, totalBounds); DrawRow(args, rowInfo); Bitmap result = new Bitmap(imageBounds.Width, imageBounds.Height); Graphics resultGraphics = Graphics.FromImage(result); float[][] matrixItems = { new float[] { 1, 0, 0, 0, 0 }, new float[] { 0, 1, 0, 0, 0 }, new float[] { 0, 0, 1, 0, 0 }, new float[] { 0, 0, 0, 0.7f, 0 }, new float[] { 0, 0, 0, 0, 1 } }; ColorMatrix colorMatrix = new ColorMatrix(matrixItems); ImageAttributes imageAttributes = new ImageAttributes(); imageAttributes.SetColorMatrix( colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); resultGraphics.DrawImage(bitmap, imageBounds, rowInfo.TotalBounds.X, rowInfo.TotalBounds.Y, rowInfo.TotalBounds.Width, rowInfo.TotalBounds.Height, GraphicsUnit.Pixel, imageAttributes); resultGraphics.DrawIcon(Icon.FromHandle(Cursors.Default.Handle), 0, 0); return(CreateCursor(result)); }
int IHeightAdaptable.CalcHeight(DevExpress.Utils.Drawing.GraphicsCache cache, int width) { CalcTextSize(cache.Graphics); return(TextSize.Height); }
public void Draw(DevExpress.Utils.Drawing.GraphicsCache cache, AnyControlEditViewInfo viewInfo) { throw new NotImplementedException(); }
public void Draw(DevExpress.Utils.Drawing.GraphicsCache cache, AnyControlEditViewInfo viewInfo) { }
protected override void DrawCore(DevExpress.Utils.Drawing.GraphicsCache cache) { cache.Graphics.Clear(Color.Transparent); cache.Graphics.DrawImage(image, DrawRect); }
static void DrawBackGroundCore(DevExpress.Utils.Drawing.GraphicsCache cache, Rectangle bounds, double completenessRatio) { Brush brush1 = new SolidBrush(Color.LightGray); cache.FillRectangle(brush1, new Rectangle(bounds.X, bounds.Y, (int)(bounds.Width * completenessRatio), bounds.Height)); }
static void DrawBackGroundCore(DevExpress.Utils.Drawing.GraphicsCache cache, Rectangle bounds, double completenessRatio) { cache.FillRectangle(Brushes.LightGray, new Rectangle(bounds.X, bounds.Y, (int)(bounds.Width * completenessRatio), bounds.Height)); }