Exemple #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));
        }
Exemple #2
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));
        }
        public static void DrawEdit(Graphics g, RepositoryItem edit, Rectangle r, object value)
        {
            BaseEditViewInfo info    = edit.CreateViewInfo() as BaseEditViewInfo;
            BaseEditPainter  painter = edit.CreatePainter();

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

            painter.Draw(args);
            args.Cache.Dispose();
        }
Exemple #4
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();
        }
Exemple #5
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 { }
        }
Exemple #6
0
        protected void DrawEditor(DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            GridCellInfo     cell   = e.Cell as GridCellInfo;
            Point            offset = cell.CellValueRect.Location;
            BaseEditPainter  pb     = cell.ViewInfo.Painter as BaseEditPainter;
            AppearanceObject style  = cell.ViewInfo.PaintAppearance;

            if (!offset.IsEmpty)
            {
                cell.ViewInfo.Offset(offset.X, offset.Y);
            }
            try
            {
                pb.Draw(new ControlGraphicsInfoArgs(cell.ViewInfo, e.Cache, cell.Bounds));
            }
            finally
            {
                if (!offset.IsEmpty)
                {
                    cell.ViewInfo.Offset(-offset.X, -offset.Y);
                }
            }
        }
        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 { }
            }
        }
        protected override void DrawRowValueCellCore(CustomDrawRowValueCellEventArgs e, BaseEditPainter pb, BaseEditViewInfo bvi, BaseViewInfo vi)
        {
            MyPropertyGridControl grid       = (MyPropertyGridControl)vi.Grid;
            RowProperties         properties = e.Row.GetRowProperties(e.CellIndex);
            DescriptorContext     context    = grid.GetDescriptorContext(properties);
            UITypeEditor          editor     = grid.GetUITypeEditor(context);

            if (editor != null && editor.GetPaintValueSupported())
            {
                int                 indent = 1;
                Size                size   = new Size(e.Bounds.Size.Height - 2 * indent, e.Bounds.Size.Height - 2 * indent);
                Rectangle           bounds = new Rectangle(e.Bounds.X + indent, e.Bounds.Y + indent, size.Width, size.Height);
                PaintValueEventArgs args   = new PaintValueEventArgs(context, grid.GetCellValue(properties.Row, 0), e.Cache.Graphics, bounds);
                editor.PaintValue(args);
                e.Cache.DrawRectangle(Pens.DarkGray, bounds);
                Rectangle textBounds = new Rectangle(e.Bounds.X + bounds.Width + 2 * indent + indent, e.Bounds.Y, e.Bounds.Width - bounds.Width + 2 * indent, e.Bounds.Height);
                grid.Appearance.RecordValue.DrawString(e.Cache, grid.GetCellDisplayText(properties.Row, 0), textBounds);
            }
            else
            {
                base.DrawRowValueCellCore(e, pb, bvi, vi);
            }
        }
Exemple #9
0
        private void lstDataView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            if (e.Column.Caption == "报警")
            {
                int rowhandle = e.RowHandle;
                if (lstDataView.GetRow(rowhandle) != null)
                {
                    string strcolors = lstDataView.GetRowCellValue(rowhandle, "Colors").ToString();
                    if (!string.IsNullOrEmpty(strcolors))
                    {
                        string[]   cols    = strcolors.Split(',');
                        List <int> lstcols = new List <int>();
                        if (cols != null && cols.Length > 0)
                        {
                            for (int i = 0; i < cols.Length; i++)
                            {
                                if (!string.IsNullOrEmpty(cols[i].Trim()))
                                {
                                    lstcols.Add(Convert.ToInt32(cols[i]));
                                }
                            }
                        }

                        if (lstcols.Count > 0)
                        {
                            e.Handled = true;
                            int width = (int)(e.Bounds.Width / lstcols.Count);

                            for (int i = 0; i < lstcols.Count; i++)
                            {
                                Rectangle rect = new Rectangle(e.Bounds.X + width * i, e.Bounds.Y, width, e.Bounds.Height);
                                Brush     b    = new SolidBrush(Colors[lstcols[i]]);
                                e.Graphics.FillRectangle(b, rect);
                            }

                            GridCellInfo    cell   = e.Cell as GridCellInfo;
                            Point           offset = cell.CellValueRect.Location;
                            BaseEditPainter pb     = cell.ViewInfo.Painter as BaseEditPainter;
                            if (!offset.IsEmpty)
                            {
                                cell.ViewInfo.Offset(offset.X, offset.Y);
                            }
                            try
                            {
                                pb.Draw(new ControlGraphicsInfoArgs(cell.ViewInfo, e.Cache, cell.Bounds));
                            }
                            finally
                            {
                                if (!offset.IsEmpty)
                                {
                                    cell.ViewInfo.Offset(-offset.X, -offset.Y);
                                }
                            }
                        }
                        else
                        {
                            e.Appearance.BackColor = cDefault;
                        }
                    }
                    else
                    {
                        e.Appearance.BackColor = cDefault;
                    }
                }
            }
        }