Esempio n. 1
0
        private void DrawRowPreviewEditor(GridViewDrawArgs e, GridDataRowInfo ri, RepositoryItem item)
        {
            GridCellInfo info = new GridCellInfo(null, ri, ri.PreviewBounds);

            info.Editor = item;
            DrawCellEdit(e, ((CustomGridViewInfo)e.ViewInfo).GetRowPreviewViewInfo(e, ri), info, ri.AppearancePreview, false);
        }
Esempio n. 2
0
        private void DrawQuickCustomisationIconCore(GridViewDrawArgs e, QuickCustomizationIcon icon, Rectangle bounds,
                                                    QuickCustomisationIconStatusEnum status)
        {
            if (icon == null)
            {
                return;
            }
            var patchedRec = new Rectangle(bounds.X + 1, bounds.Y, bounds.Width - 1, bounds.Height);
            var args       = new GridColumnInfoArgs(e.Cache, e.ViewInfo.ColumnsInfo[0].Column)
            {
                Cache          = e.Cache,
                Bounds         = patchedRec,
                HeaderPosition = HeaderPositionKind.Center
            };

            if (status == QuickCustomisationIconStatusEnum.Hot)
            {
                args.State = ObjectState.Hot;
            }
            ElementsPainter.Column.DrawObject(args);
            if (icon.Image == null)
            {
                icon.Image = Resources.Customization;
            }
            var rec = new Rectangle
            {
                Location = new Point(bounds.Left + (bounds.Width - icon.Image.Width) / 2, bounds.Top + (bounds.Height - icon.Image.Height) / 2),
                Size     = new Size(icon.Image.Width, icon.Image.Height)
            };

            e.Graphics.PageUnit = GraphicsUnit.Pixel;
            e.Graphics.DrawImageUnscaled(icon.Image, rec);
        }
 protected virtual void DrawQuickCustomisationIcon(GridViewDrawArgs e, IndicatorObjectInfoArgs info, IndicatorKind kind)
 {
     if (kind == DevExpress.Utils.Drawing.IndicatorKind.Header && ((CustomGridViewInfo)e.ViewInfo).QuickCustomisationIconStatus != QuickCustomisationIconStatus.Hidden)
     {
         DrawQuickCustomisationIconCore(e, info, ((CustomGridViewInfo)e.ViewInfo).QuickCustomisationIcon, ((CustomGridViewInfo)e.ViewInfo).QuickCustomisationBounds, ((CustomGridViewInfo)e.ViewInfo).QuickCustomisationIconStatus);
     }
 }
Esempio n. 4
0
 private void DrawQuickCustomisationIconCore(GridViewDrawArgs e, QuickCustomizationIcon icon, Rectangle bounds,
     QuickCustomisationIconStatusEnum status)
 {
     if (icon == null)
     {
         return;
     }
     var patchedRec = new Rectangle(bounds.X + 1, bounds.Y, bounds.Width - 1, bounds.Height);
     var args = new GridColumnInfoArgs(e.Cache, e.ViewInfo.ColumnsInfo[0].Column)
     {
         Cache = e.Cache,
         Bounds = patchedRec,
         HeaderPosition = HeaderPositionKind.Center
     };
     if (status == QuickCustomisationIconStatusEnum.Hot)
     {
         args.State = ObjectState.Hot;
     }
     ElementsPainter.Column.DrawObject(args);
     if (icon.Image == null)
     {
         icon.Image = Resources.Customization;
     }
     var rec = new Rectangle
     {
         Location = new Point(bounds.Left + (bounds.Width - icon.Image.Width) / 2, bounds.Top + (bounds.Height - icon.Image.Height) / 2),
         Size = new Size(icon.Image.Width, icon.Image.Height)
     };
     e.Graphics.PageUnit = GraphicsUnit.Pixel;
     e.Graphics.DrawImageUnscaled(icon.Image, rec);
 }
 protected override void DrawRowCell(GridViewDrawArgs e, GridCellInfo cell)
 {
     cell.ViewInfo.MatchedStringUseContains = true;
     cell.ViewInfo.MatchedString = View.GetExtraFilterText;
     cell.State = GridRowCellState.Dirty;
     e.ViewInfo.UpdateCellAppearance(cell);
     base.DrawRowCell(e, cell);
 }
Esempio n. 6
0
 public virtual BaseEditViewInfo GetRowPreviewViewInfo(GridViewDrawArgs e, GridDataRowInfo ri)
 {
     fRowPreviewViewInfo.Bounds    = GetRowPreviewEditBounds(ri);
     fRowPreviewViewInfo.EditValue = View.GetRowPreviewValue(ri.RowHandle);
     fRowPreviewViewInfo.Focused   = true;
     fRowPreviewViewInfo.CalcViewInfo(e.Graphics);
     return(fRowPreviewViewInfo);
 }
Esempio n. 7
0
 protected override void DrawRowCell(GridViewDrawArgs e, GridCellInfo cell)
 {
     cell.ViewInfo.MatchedStringUseContains = true;
     cell.ViewInfo.MatchedString            = View.GetExtraFilterText;
     cell.State = GridRowCellState.Dirty;
     e.ViewInfo.UpdateCellAppearance(cell);
     base.DrawRowCell(e, cell);
 }
Esempio n. 8
0
 private void DrawQuickCustomisationIcon(GridViewDrawArgs e, IndicatorKind kind)
 {
     if (kind != IndicatorKind.Header)
     {
         return;
     }
     var viewInfo = (CommonGridViewInfo)e.ViewInfo;
     DrawQuickCustomisationIconCore(e, viewInfo.QuickCustomisationIcon, viewInfo.QuickCustomisationBounds,
         viewInfo.QuickCustomisationIconStatus);
 }
Esempio n. 9
0
        protected virtual void DrawButton(GridViewDrawArgs e)
        {
            EditorButtonObjectInfoArgs info = (e.ViewInfo as MyGridViewInfo).ButtonInfo;

            if (info != null)
            {
                EditorButtonPainter painter = EditorButtonHelper.GetPainter(BorderStyles.Default);
                info.Cache = e.Cache;
                painter.DrawObject(info);
            }
        }
Esempio n. 10
0
        private void DrawQuickCustomisationIcon(GridViewDrawArgs e, IndicatorKind kind)
        {
            if (kind != IndicatorKind.Header)
            {
                return;
            }
            var viewInfo = (CommonGridViewInfo)e.ViewInfo;

            DrawQuickCustomisationIconCore(e, viewInfo.QuickCustomisationIcon, viewInfo.QuickCustomisationBounds,
                                           viewInfo.QuickCustomisationIconStatus);
        }
Esempio n. 11
0
        protected override void DrawRowPreview(GridViewDrawArgs e, GridDataRowInfo ri)
        {
            RepositoryItem item = ((CustomGridView)e.ViewInfo.View).PreviewRowEdit;

            if (item == null)
            {
                base.DrawRowPreview(e, ri);
            }
            else
            {
                DrawRowPreviewEditor(e, ri, item);
            }
        }
Esempio n. 12
0
        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));
        }
        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);
        }
Esempio n. 14
0
        protected override void DrawRegularRow(GridViewDrawArgs e, GridDataRowInfo ri)
        {
            base.DrawRegularRow(e, ri);
            if (ri.IsMasterRow && ri.MasterRowExpanded)
            {
                GridView detailView = View.GetDetailView(ri.RowHandle, 0) as GridView;
                if (detailView == null)
                {
                    return;
                }

                int   level = 0;
                Point p1;
                Point p2;

                GridCellInfo cell = ri.Cells[View.VisibleColumns[0]];
                int          center;
                if (cell != null)
                {
                    center = cell.CellButtonRect.Left + cell.CellButtonRect.Width / 2;
                }
                else
                {
                    center = ri.DetailIndentBounds.Left + ri.DetailIndentBounds.Width / 2;
                }

                GridViewInfo detailViewInfo = (GridViewInfo)detailView.GetViewInfo();
                foreach (GridRowInfo rowInfo in detailViewInfo.RowsInfo)
                {
                    if (detailView.IsRowVisible(rowInfo.RowHandle) != RowVisibleState.Visible)
                    {
                        continue;
                    }
                    level = rowInfo.Bounds.Top + rowInfo.Bounds.Height / 2;
                    p1    = new Point(center, level);
                    p2    = new Point(ri.DetailIndentBounds.Right, level);
                    e.Cache.DrawLine(Pens.Black, p1, p2);
                }
                p1 = new Point(center, ri.DetailIndentBounds.Top);
                p2 = new Point(center, level);
                e.Cache.DrawLine(Pens.Black, p1, p2);
            }
        }
Esempio n. 15
0
        public static void DoDefaultDrawCell(GridView view, RowCellCustomDrawEventArgs e)
        {
            PropertyInfo pi;
            GridControl  grid;
            GridViewInfo info;
            GridCellInfo cell;
            GridEditorContainerHelper helper;
            GridViewDrawArgs          args;

            info = view.GetViewInfo() as GridViewInfo;
            cell = e.Cell as GridCellInfo;
            grid = view.GridControl;
            pi   = grid.GetType().GetProperty("EditorHelper", BindingFlags.NonPublic |
                                              BindingFlags.Instance | BindingFlags.DeclaredOnly);
            helper = pi.GetValue(grid, null) as GridEditorContainerHelper;
            args   = new GridViewDrawArgs(e.Cache, info, e.Bounds);
            e.Appearance.FillRectangle(e.Cache, e.Bounds);
            helper.DrawCellEdit(args, cell.Editor, cell.ViewInfo, e.Appearance,
                                cell.CellValueRect.Location);
        }
Esempio n. 16
0
        protected virtual void DrawQuickCustomisationIconCore(GridViewDrawArgs e, IndicatorObjectInfoArgs info, QuickCustomizationIcon icon, Rectangle bounds, QuickCustomisationIconStatus status)
        {
            Rectangle patchedRec = new Rectangle(bounds.X + 1, bounds.Y, bounds.Width - 1, bounds.Height);
            GridColumnInfoArgs args = new GridColumnInfoArgs(e.Cache, e.ViewInfo.ColumnsInfo[0].Column);
            args.Cache = e.Cache;
            args.Bounds = patchedRec;
            ((HeaderObjectInfoArgs)args).HeaderPosition = HeaderPositionKind.Center;
            if (status == QuickCustomisationIconStatus.Hot)
                ((HeaderObjectInfoArgs)args).State = ObjectState.Hot;
            ElementsPainter.Column.DrawObject(args);

            if (icon.Image != null)
            {
                Rectangle rec = new Rectangle();
                rec.Location = new Point(bounds.Left + 1, bounds.Top + 1);
                rec.Size = new Size(bounds.Width - 2, bounds.Height - 2);
                ImageAttributes attr = new ImageAttributes();
                attr.SetColorKey(icon.TransperentColor, icon.TransperentColor);
                e.Graphics.DrawImage(icon.Image, rec, 0, 0, icon.Image.Width, icon.Image.Height, GraphicsUnit.Pixel, attr);
            }
        }
Esempio n. 17
0
        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));
        }
        protected virtual void DrawEmptyAreaLines(GridViewDrawArgs e)
        {
            GridViewRects rects = e.ViewInfo.ViewRects;
            Rectangle     er    = rects.EmptyRows;

            if (er.IsEmpty)
            {
                return;
            }

            Pen pen = SystemPens.ControlDark;

            if (View.OptionsView.ShowVerticalLines != DevExpress.Utils.DefaultBoolean.False)
            {
                foreach (GridColumnInfoArgs column in e.ViewInfo.ColumnsInfo)
                {
                    int x = column.Bounds.Right - 1;
                    if ((column.Column != null && column.Column.Fixed != DevExpress.XtraGrid.Columns.FixedStyle.None) ||
                        ((rects.FixedLeft.IsEmpty || x > rects.FixedLeft.Right) &&
                         (rects.FixedRight.IsEmpty || x < rects.FixedRight.Left - 3)))
                    {
                        e.Cache.DrawLine(pen, new Point(x, er.Top), new Point(x, er.Bottom));
                    }
                }
                if (!rects.FixedRight.IsEmpty)
                {
                    e.Cache.DrawLine(pen, new Point(rects.FixedRight.Left - 1, er.Top), new Point(rects.FixedRight.Left - 1, er.Bottom));
                }
            }

            if (View.OptionsView.ShowHorizontalLines != DevExpress.Utils.DefaultBoolean.False)
            {
                int rowHeight = e.ViewInfo.MinRowHeight;
                for (int y = er.Top + rowHeight; y < er.Bottom; y += rowHeight)
                {
                    e.Cache.DrawLine(pen, new Point(er.Left, y), new Point(rects.DataRectRight.Right - 1, y));
                }
            }
        }
Esempio n. 19
0
        protected override void DrawCellEdit(GridViewDrawArgs e, BaseEditViewInfo editInfo, GridCellInfo cell, AppearanceObject appearance, bool isSelectedCell)
        {
            IIconSelector iconSelector = cell.Editor as IIconSelector;

            if (iconSelector != null)
            {
                OnIconSelectionEventHandler EH = new OnIconSelectionEventHandler(iconSelector_OnIconSelection);
                iconSelector.OnIconSelection += EH;
                nowDrawingCellInfo            = cell;
                try
                {
                    base.DrawCellEdit(e, editInfo, cell, appearance, isSelectedCell);
                }
                finally
                {
                    iconSelector.OnIconSelection -= EH;
                }
            }
            else
            {
                base.DrawCellEdit(e, editInfo, cell, appearance, isSelectedCell);
            }
        }
Esempio n. 20
0
        private Cursor GetDragCursor(int rowHandle, Point e)
        {
            var info        = (GridViewInfo)_view.GetViewInfo();
            var rowInfo     = info.GetGridRowInfo(rowHandle);
            var imageBounds = new Rectangle(new Point(0, 0), rowInfo.TotalBounds.Size);
            var totalBounds = new Rectangle(new Point(0, 0), info.Bounds.Size);

            //Grid
            using (var bitmap = new Bitmap(totalBounds.Width, totalBounds.Height))
                using (var gridBitmap = new Bitmap(totalBounds.Width, totalBounds.Height))
                    using (var cache = new GraphicsCache(Graphics.FromImage(bitmap)))
                        using (var result = new Bitmap(imageBounds.Width, imageBounds.Height))
                            using (var resultGraphics = Graphics.FromImage(result))
                                using (var imageAttributes = new ImageAttributes())
                                {
                                    _view.GridControl.DrawToBitmap(gridBitmap, _view.GridControl.Bounds);
                                    var args = new GridViewDrawArgs(cache, info, totalBounds);
                                    DrawRow(args, rowInfo);

                                    float[][] matrixItems =
                                    {
                                        new float[] { 1, 0, 0,    0, 0 },
                                        new float[] { 0, 1, 0,    0, 0 },
                                        new float[] { 0, 0, 1,    0, 0 },
                                        new[]       { 0, 0, 0, 0.7f, 0 },
                                        new float[] { 0, 0, 0,    0, 1 }
                                    };
                                    var colorMatrix = new ColorMatrix(matrixItems);
                                    imageAttributes.SetColorMatrix(
                                        colorMatrix,
                                        ColorMatrixFlag.Default,
                                        ColorAdjustType.Bitmap);
                                    resultGraphics.DrawImage(gridBitmap, imageBounds, rowInfo.TotalBounds.X, rowInfo.TotalBounds.Y + _rowVerticalOffset, rowInfo.TotalBounds.Width, rowInfo.TotalBounds.Height, GraphicsUnit.Pixel, imageAttributes);
                                    var offset = new Point(e.X - rowInfo.TotalBounds.X, e.Y - rowInfo.TotalBounds.Y);
                                    return(CreateCursor(result, offset));
                                }
        }
        protected virtual void DrawSpacingColumns(GridViewDrawArgs e)
        {
            RectangleF columnBounds;
            RectangleF columnSpacing;

            for (int i = 0; i < View.VisibleColumns.Count; i++)
            {
                var myColumn = View.VisibleColumns[i] as MyGridColumn;
                columnBounds = GetColumnBounds(View as MyGridView, myColumn);
                if (columnBounds != null)
                {
                    columnBounds.Height -= 2;
                    if (i > 0)
                    {
                        columnSpacing = new RectangleF(columnBounds.Left - myColumn.ColumnSpacing, columnBounds.Top, myColumn.ColumnSpacing, columnBounds.Height);
                        e.Graphics.FillRectangle(e.ViewInfo.PaintAppearance.Empty.GetBackBrush(e.Cache), columnSpacing);
                    }

                    if ((i == View.VisibleColumns.Count - 1) && (myColumn.ColumnSpacing != 0))
                    {
                        columnSpacing = new RectangleF(columnBounds.Left + columnBounds.Width, columnBounds.Top, View.ViewRect.Width, columnBounds.Height);
                    }
                    else
                    {
                        columnSpacing = new RectangleF(columnBounds.Left + columnBounds.Width, columnBounds.Top, myColumn.ColumnSpacing, columnBounds.Height);
                    }
                    e.Graphics.FillRectangle(e.ViewInfo.PaintAppearance.Empty.GetBackBrush(e.Cache), columnSpacing);

                    columnBounds.X       = columnBounds.Left - 1;
                    columnBounds.Width   = 1;
                    columnBounds.Height += 1;

                    e.Graphics.FillRectangle(e.ViewInfo.PaintAppearance.VertLine.GetBackBrush(e.Cache), columnBounds);
                }
            }
        }
Esempio n. 22
0
 protected override void DrawIndicatorCore(GridViewDrawArgs e, IndicatorObjectInfoArgs info, int rowHandle, IndicatorKind kind)
 {
     base.DrawIndicatorCore(e, info, rowHandle, kind);
     DrawQuickCustomisationIcon(e, info, kind);
 }
Esempio n. 23
0
 protected override void DrawIndicatorCore(GridViewDrawArgs e, IndicatorObjectInfoArgs info, int rowHandle, IndicatorKind kind)
 {
     base.DrawIndicatorCore(e, info, rowHandle, kind);
     DrawQuickCustomisationIcon(e, kind);
 }
 protected override void DrawRows(GridViewDrawArgs e)
 {
     base.DrawRows(e);
     DrawEmptyAreaLines(e);
 }
 protected override void DrawContents(GridViewDrawArgs e)
 {
     base.DrawContents(e);
     DrawSpacingColumns(e);
 }
Esempio n. 26
0
 protected override void DrawColumnPanel(GridViewDrawArgs e)
 {
     (View as CGridView).IsColumnPainting = true;
     base.DrawColumnPanel(e);
     (View as CGridView).IsColumnPainting = false;
 }
		private Cursor GetDragCursor(int rowHandle, Point e)
		{
			var info = (GridViewInfo)_view.GetViewInfo();
			var rowInfo = info.GetGridRowInfo(rowHandle);
			var imageBounds = new Rectangle(new Point(0, 0), rowInfo.TotalBounds.Size);
			var totalBounds = new Rectangle(new Point(0, 0), info.Bounds.Size);
			//Grid
			using (var bitmap = new Bitmap(totalBounds.Width, totalBounds.Height))
			using (var gridBitmap = new Bitmap(totalBounds.Width, totalBounds.Height))
			using (var cache = new GraphicsCache(Graphics.FromImage(bitmap)))
			using (var result = new Bitmap(imageBounds.Width, imageBounds.Height))
			using (var resultGraphics = Graphics.FromImage(result))
			using (var imageAttributes = new ImageAttributes())
			{
				_view.GridControl.DrawToBitmap(gridBitmap, _view.GridControl.Bounds);
				var args = new GridViewDrawArgs(cache, info, totalBounds);
				DrawRow(args, rowInfo);

				float[][] matrixItems =
				{
					new float[] { 1, 0, 0, 0, 0 },
					new float[] { 0, 1, 0, 0, 0 },
					new float[] { 0, 0, 1, 0, 0 },
					new[] { 0, 0, 0, 0.7f, 0 },
					new float[] { 0, 0, 0, 0, 1 }
				};
				var colorMatrix = new ColorMatrix(matrixItems);
				imageAttributes.SetColorMatrix(
					colorMatrix,
					ColorMatrixFlag.Default,
					ColorAdjustType.Bitmap);
				resultGraphics.DrawImage(gridBitmap, imageBounds, rowInfo.TotalBounds.X, rowInfo.TotalBounds.Y + _rowVerticalOffset, rowInfo.TotalBounds.Width, rowInfo.TotalBounds.Height, GraphicsUnit.Pixel, imageAttributes);
				var offset = new Point(e.X - rowInfo.TotalBounds.X, e.Y - rowInfo.TotalBounds.Y);
				return CreateCursor(result, offset);
			}
		}
Esempio n. 28
0
 protected override void DrawRows(GridViewDrawArgs e)
 {
     base.DrawRows(e);
     DrawButton(e);
 }