Ejemplo n.º 1
0
        void DrawTestEditor(GraphicsCache cache, string text)
        {
            if (FilterViewInfo.Owner.OwnerControl.FocusedItem == this &&
                FilterViewInfo.Owner.OwnerControl.ActiveEditor != null)
            {
                return;
            }
            ClauseNode node = FilterViewInfo.Owner as ClauseNode;

            if (node == null)
            {
                return;
            }
            RepositoryItem ri = node.OwnerControl.GetRepositoryItem(node).Clone() as RepositoryItem;

            ri.BorderStyle = FilterViewInfo.Owner.OwnerControl.FocusedItem == this ? DevExpress.XtraEditors.Controls.BorderStyles.Default : DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
            BaseEditPainter  p  = ri.CreatePainter();
            BaseEditViewInfo vi = ri.CreateViewInfo();

            vi.EditValue = this.TextElement.Text;
            vi.PaintAppearance.Assign(FilterViewInfo.Owner.OwnerControl.FilterViewInfo.PaintAppearance);
            vi.Bounds = LabelInfoHelper.GetEditorBoundsByElement(this);
            vi.CalcViewInfo(cache.Graphics);
            p.Draw(new ControlGraphicsInfoArgs(vi, cache, vi.Bounds));
        }
Ejemplo n.º 2
0
        void GridViewOnCustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            BaseEditViewInfo info = ((GridCellInfo)e.Cell).ViewInfo;
            var   enumDescriptor  = new EnumDescriptor(typeof(ErrorType));
            var   row             = ((GridView)sender).GetRow(e.RowHandle);
            var   resultItem      = row as DisplayableValidationResultItem;
            Image errorIcon       = null;

            if (resultItem != null)
            {
                errorIcon = ErrorIcon(resultItem, enumDescriptor);
            }
            else if (Columns.Any())
            {
                var keyValuePairs = Columns.SelectMany(types => types);
                var propertyName  = e.Column.PropertyName();
                Func <KeyValuePair <ColumnWrapper, Validation.RuleType.RuleType>, bool> predicate = pair => propertyName == pair.Key.PropertyName;
                if (keyValuePairs.Any(predicate))
                {
                    var caption = keyValuePairs.Last(predicate).Value.ToString();
                    errorIcon = DXErrorProvider.GetErrorIconInternal((ErrorType)enumDescriptor.ParseCaption(caption));
                }
            }
            if (errorIcon != null)
            {
                info.ErrorIcon = errorIcon;
                info.CalcViewInfo(e.Graphics);
            }
        }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
        private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            BaseEditViewInfo info  = ((GridCellInfo)e.Cell).ViewInfo;
            string           error = GetError(e.CellValue, e.RowHandle, e.Column);

            SetError(info, error);
            info.CalcViewInfo(e.Cache.Graphics);
        }
Ejemplo n.º 5
0
 private void gridViewStops_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (e.RowHandle == GridControl.NewItemRowHandle)
     {
         BaseEditViewInfo info = ((GridCellInfo)e.Cell).ViewInfo;
         info.ShowErrorIcon = false;
         info.CalcViewInfo(e.Graphics);
     }
 }
Ejemplo n.º 6
0
        private void DrawGroupEditor(DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e)
        {
            GridViewInfo     viewInfo         = view.GetViewInfo() as GridViewInfo;
            GridColumn       col              = viewInfo.GetNearestColumn(HotTrackRectangle.Location);
            BaseEditPainter  groupEditPainter = GetGroupEditPainter(col);
            BaseEditViewInfo editViewInfo     = GetGroupEditViewInfo(col);

            editViewInfo.Bounds = HotTrackRectangle;
            editViewInfo.CalcViewInfo(e.Graphics);
            e.Cache.FillRectangle(viewInfo.PaintAppearance.Row.GetBackBrush(e.Cache), HotTrackRectangle);
            groupEditPainter.Draw(new ControlGraphicsInfoArgs(editViewInfo, e.Cache, HotTrackRectangle));
        }
Ejemplo n.º 7
0
        public static void DrawEdit(Graphics g, RepositoryItem edit, Rectangle r, object value)
        {
            BaseEditViewInfo info = edit.CreateViewInfo();

            info.EditValue = value;
            info.Bounds    = r;
            info.CalcViewInfo(g);
            ControlGraphicsInfoArgs args = new ControlGraphicsInfoArgs(info, new GraphicsCache(g), r);

            edit.CreatePainter().Draw(args);
            args.Cache.Dispose();
        }
Ejemplo n.º 8
0
        protected void DrawCheckBox(Graphics g, Rectangle r, bool Checked)
        {
            BaseEditPainter  painter = GroupEdit.CreatePainter();
            BaseEditViewInfo info    = GroupEdit.CreateViewInfo();

            info.EditValue = Checked;
            info.Bounds    = r;
            info.CalcViewInfo(g);
            ControlGraphicsInfoArgs args = new ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(g), r);

            painter.Draw(args);
            args.Cache.Dispose();
        }
        private void propertyGridControl1_CustomDrawRowValueCell(object sender, CustomDrawRowValueCellEventArgs e)
        {
            if (e.CellValue != null)
            {
                return;
            }
            BaseRowViewInfo  rowInfo      = GetRowInfo(e);
            BaseEditViewInfo editViewInfo = GetEditorViewInfo(rowInfo, e);

            editViewInfo.ErrorIconText  = "IsNull";
            editViewInfo.ShowErrorIcon  = true;
            editViewInfo.FillBackground = true;
            editViewInfo.ErrorIcon      = DXErrorProvider.GetErrorIconInternal(ErrorType.Critical);
            editViewInfo.CalcViewInfo(e.Graphics);
        }
Ejemplo n.º 10
0
        protected virtual BaseEditViewInfo CreateRowPreviewViewInfo(RepositoryItem item)
        {
            BaseEditViewInfo info = item.CreateViewInfo();

            UpdateEditViewInfo(info);
            Graphics g = GInfo.AddGraphics(null);

            try
            {
                info.CalcViewInfo(g);
            }
            finally
            {
                GInfo.ReleaseGraphics();
            }
            return(info);
        }
Ejemplo n.º 11
0
        private void groupControl3_Paint(object sender, PaintEventArgs e)
        {
            Bitmap bm = new Bitmap(cc.Width, cc.Height);

            cc.DrawToBitmap(bm, cc.Bounds);
            BaseEditPainter  pb   = cc.Properties.CreatePainter();
            BaseEditViewInfo bevi = cc.Properties.CreateViewInfo();

            bevi.CalcViewInfo(e.Graphics, MouseButtons.Left, new Point(0, 0), cc.Bounds);
            GraphicsCache gc = new GraphicsCache(e.Graphics);

            try
            {
                pb.Draw(new ControlGraphicsInfoArgs(bevi, gc, cc.Bounds));
            }
            catch { }
        }
        void DrawEditors(List <BaseEdit> editors, ControlGraphicsInfoArgs info, CustomRepositoryItem cri)
        {
            foreach (BaseEdit editor in editors)
            {
                RepositoryItem ri = cri.ControlRepositories[editor.EditorTypeName];
                ri.Assign(editor.Properties);
                BaseEditViewInfo bevi = ri.CreateViewInfo();
                bevi.EditValue = editor.EditValue;
                Rectangle rec = editor.Bounds;

                rec.X += info.ViewInfo.Bounds.X;
                rec.Y += info.ViewInfo.Bounds.Y;

                bevi.CalcViewInfo(info.Graphics, MouseButtons.Left, new Point(0, 0), rec);
                ControlGraphicsInfoArgs cinfo = new ControlGraphicsInfoArgs(bevi, info.Cache, info.ViewInfo.Bounds);
                BaseEditPainter         bp    = ri.CreatePainter();
                try
                {
                    bp.Draw(cinfo);
                }
                catch { }
            }
        }