public Cursor GetDragCursor(int rowHandle, Point e) { GridViewInfo info = _view.GetViewInfo() as GridViewInfo; GridRowInfo rowInfo = info.GetGridRowInfo(rowHandle); Bitmap result = GetRowDragBitmap(rowHandle); Point offset = new Point(rowInfo.Bounds.X, e.Y - rowInfo.Bounds.Y); return(CursorCreator.CreateCursor(result, offset)); }
public Cursor GetDragCellCursor(GridHitInfo hitInfo, Point e) { GridViewInfo info = _View.GetViewInfo() as GridViewInfo; GridCellInfo cellinfo = info.GetGridCellInfo(hitInfo); Rectangle imageBounds = new Rectangle(new Point(0, 0), cellinfo.Bounds.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); base.DrawRowCell(args, cellinfo); 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, cellinfo.Bounds.X, cellinfo.Bounds.Y, cellinfo.Bounds.Width, cellinfo.Bounds.Height, GraphicsUnit.Pixel, imageAttributes); resultGraphics.DrawIcon(Icon.FromHandle(Cursors.Default.Handle), 0, 0); return(CreateCursor(result)); }