private void validationProvider1_ValidationFailed(object sender, ValidationFailedEventArgs e) { BaseEdit edit = e.InvalidControl as BaseEdit; if (edit == null) { return; } BaseEditViewInfo viewInfo = edit.GetViewInfo() as BaseEditViewInfo; if (viewInfo == null) { return; } if (edit.ToolTipController == null) { edit.ToolTipController = new ToolTipControllerDefault(); } ToolTipControlInfo info = new ToolTipControlInfo(e.InvalidControl, e.ErrorText); info.ToolTipPosition = edit.PointToScreen(viewInfo.ErrorIconBounds.Location); edit.ToolTipController.InitialDelay = 0; edit.ToolTipController.ShowHint(info); }
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)); }
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); } }
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); }
public override void Draw(ControlGraphicsInfoArgs info) { base.Draw(info); BaseEditViewInfo vi = info.ViewInfo as BaseEditViewInfo; RepositoryItemInplaceDataNavigator cri = vi.Item as RepositoryItemInplaceDataNavigator; PaintEventArgs e = new PaintEventArgs(info.Graphics, vi.Bounds); cri.EditNavigator.Draw(e); }
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); } }
protected override void DrawFocusRect(ControlGraphicsInfoArgs info) { BaseEditViewInfo vi = info.ViewInfo as BaseEditViewInfo; if (vi != null && vi.DrawFocusRect) { DrawCustomBorder(info); return; } base.DrawFocusRect(info); }
void SetError(BaseEditViewInfo cellInfo, string errorIconText) { if (errorIconText == string.Empty) { return; } cellInfo.ErrorIconText = errorIconText; cellInfo.ShowErrorIcon = true; cellInfo.FillBackground = true; cellInfo.ErrorIcon = DXErrorProvider.GetErrorIconInternal(ErrorType.Critical); }
public virtual void UpdateRowPreviewEdit(RepositoryItem item) { if (item != null) { fRowPreviewViewInfo = CreateRowPreviewViewInfo(item); } else { fRowPreviewViewInfo = null; } }
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(); 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(); }
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); }
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); }
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 { } }
protected override void DrawContent(ControlGraphicsInfoArgs info) { base.DrawContent(info); BaseEditViewInfo viewInfo = info.ViewInfo as BaseEditViewInfo; RepositoryItemCustomEdit item = viewInfo.Item as RepositoryItemCustomEdit; string[] values = item.ParseValues(viewInfo.EditValue); string[] captions = item.GetRowCaptions(); Color rowHeaderColor = GetRowHeaderColor(); Color gridLineColor = GetGridLineColor(); Color gridBorderColor = GetGridBorderColor(); for (int i = 0; i < 5; i++) { Rectangle rowHeaderRect = new Rectangle(info.Bounds.X + 1, info.Bounds.Y + RepositoryItemCustomEdit.RowHeight * i + i + 1, RepositoryItemCustomEdit.RowHeaderWidth, RepositoryItemCustomEdit.RowHeight); Rectangle recordRect = new Rectangle(rowHeaderRect.Right + 2, info.Bounds.Y + RepositoryItemCustomEdit.RowHeight * i + i, RepositoryItemCustomEdit.RecordWidth, RepositoryItemCustomEdit.RowHeight); info.Graphics.DrawLine(new Pen(gridLineColor), info.Bounds.X, info.Bounds.Y + RepositoryItemCustomEdit.RowHeight * i + i, recordRect.Right + 3, info.Bounds.Y + RepositoryItemCustomEdit.RowHeight * i + i); if (values.Length > i) { info.Graphics.DrawString(values[i], info.ViewInfo.PaintAppearance.Font, info.ViewInfo.PaintAppearance.GetForeBrush(info.Cache), recordRect.Location); } info.Graphics.FillRectangle(new SolidBrush(rowHeaderColor), rowHeaderRect); StringFormat format = new StringFormat(); format.Alignment = StringAlignment.Far; info.Graphics.DrawString(captions[i], info.ViewInfo.PaintAppearance.Font, info.ViewInfo.PaintAppearance.GetForeBrush(info.Cache), rowHeaderRect, format); } info.Graphics.DrawLine(new Pen(gridLineColor), info.Bounds.X, info.Bounds.Y + RepositoryItemCustomEdit.RowHeight * 5 + 5, info.Bounds.X + RepositoryItemCustomEdit.RowHeaderWidth + RepositoryItemCustomEdit.RecordWidth + 3, info.Bounds.Y + RepositoryItemCustomEdit.RowHeight * 5 + 5); info.Graphics.DrawLine(new Pen(gridLineColor), info.Bounds.X, info.Bounds.Y, info.Bounds.X, info.Bounds.Y + RepositoryItemCustomEdit.RowHeight * 5 + 5); info.Graphics.DrawLine(new Pen(gridLineColor), info.Bounds.X + RepositoryItemCustomEdit.RowHeaderWidth + RepositoryItemCustomEdit.RecordWidth + 5, info.Bounds.Y, info.Bounds.X + RepositoryItemCustomEdit.RowHeaderWidth + RepositoryItemCustomEdit.RecordWidth + 5, info.Bounds.Y + RepositoryItemCustomEdit.RowHeight * 5 + 5); info.Graphics.DrawLine(new Pen(gridLineColor), info.Bounds.X + RepositoryItemCustomEdit.RowHeaderWidth + 1, info.Bounds.Y, info.Bounds.X + RepositoryItemCustomEdit.RowHeaderWidth + 1, info.Bounds.Y + RepositoryItemCustomEdit.RowHeight * 5 + 5); }
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); } }
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); } }
internal string GoAndGetRowCellDisplayTextCore(int rowHandle, GridColumn column, BaseEditViewInfo bev, object value, bool forGroupRow) { return(base.GetRowCellDisplayTextCore(rowHandle, column, bev, value, forGroupRow)); }