protected int GetCheckBoxWidth() { DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo info = edit.CreateViewInfo() as DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo; int width = 0; GraphicsInfo.Default.AddGraphics(null); try { width = info.CalcBestFit(GraphicsInfo.Default.Graphics).Width; } finally { GraphicsInfo.Default.ReleaseGraphics(); } return(width + CheckboxIndent * 2); }
private void DrawCheckBox(Graphics g, Rectangle r, RepositoryItemCheckEdit checkEdit, CheckState state) { DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo info; DevExpress.XtraEditors.Drawing.CheckEditPainter painter; DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs args; checkEdit.AllowGrayed = true; info = checkEdit.CreateViewInfo() as DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo; if (state == CheckState.Unchecked) { info.EditValue = false; } else if (state == CheckState.Checked) { info.EditValue = true; } else { info.EditValue = null; } painter = checkEdit.CreatePainter() as DevExpress.XtraEditors.Drawing.CheckEditPainter; info.Bounds = r; info.PaintAppearance.ForeColor = Color.FromArgb(180, 180, 180); info.CalcViewInfo(g); args = new DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(g), r); painter.Draw(args); args.Cache.Dispose(); }
public static void DrawCheckBox (DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e, bool chk) { RepositoryItemCheckEdit repositoryCheck = e.Column.ColumnEdit as RepositoryItemCheckEdit; if (repositoryCheck != null) { Graphics g = e.Graphics; Rectangle r = e.Bounds; DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo info; DevExpress.XtraEditors.Drawing.CheckEditPainter painter; DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs args; info = repositoryCheck.CreateViewInfo() as DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo; painter = repositoryCheck.CreatePainter() as DevExpress.XtraEditors.Drawing.CheckEditPainter; info.EditValue = chk; info.Bounds = r; info.CalcViewInfo(g); args = new DevExpress.XtraEditors. Drawing.ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(g), r); painter.Draw(args); args.Cache.Dispose(); } }
private void CheckBoxEkle(GraphicsCache cache, Rectangle r, bool check) { var info = (CheckEditViewInfo)_checkEdit.CreateViewInfo(); var painter = (CheckEditPainter)_checkEdit.CreatePainter(); if (info == null) return; info.EditValue = check; info.Bounds = r; info.CalcViewInfo(cache.Graphics); var arg = new ControlGraphicsInfoArgs(info, cache, r); painter?.Draw(arg); }
protected void DrawCheckBox(Graphics g, RepositoryItemCheckEdit edit, Rectangle r, bool Checked) { var info = edit.CreateViewInfo() as CheckEditViewInfo; var painter = edit.CreatePainter() as CheckEditPainter; info.EditValue = Checked; info.Bounds = r; info.CalcViewInfo(g); var args = new ControlGraphicsInfoArgs(info, new GraphicsCache(g), r); painter.Draw(args); args.Cache.Dispose(); }
protected void DrawCheckBox(Graphics g, Rectangle r, bool Checked) { DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo info = edit.CreateViewInfo() as DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo; DevExpress.XtraEditors.Drawing.CheckEditPainter painter = edit.CreatePainter() as DevExpress.XtraEditors.Drawing.CheckEditPainter; DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs args; info.EditValue = Checked; info.Bounds = r; info.CalcViewInfo(g); args = new DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(g), r); painter.Draw(args); args.Cache.Dispose(); }
protected void DrawCheckBox(Graphics g, Rectangle r, bool Checked) { var info = _edit.CreateViewInfo() as CheckEditViewInfo; var painter = _edit.CreatePainter() as CheckEditPainter; ControlGraphicsInfoArgs args; info.EditValue = Checked; info.Bounds = r; info.CalcViewInfo(g); args = new ControlGraphicsInfoArgs(info, new GraphicsCache(g), r); painter.Draw(args); args.Cache.Dispose(); }
protected void DrawCheckBox(Graphics g, Rectangle r, bool @checked) { var info = (CheckEditViewInfo)m_Edit.CreateViewInfo(); var painter = (CheckEditPainter)m_Edit.CreatePainter(); info.EditValue = @checked; info.Bounds = r; info.CalcViewInfo(g); var args = new ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(g), r); painter.Draw(args); args.Cache.Dispose(); }
protected Rectangle CalcCheckBoxRect(GraphicsCache cache, Rectangle bounds) { RepositoryItemCheckEdit checkBox = new RepositoryItemCheckEdit(); CheckEditViewInfo viewInfo = (CheckEditViewInfo)checkBox.CreateViewInfo(); viewInfo.Bounds = bounds; viewInfo.CalcViewInfo(cache.Graphics); ControlGraphicsInfoArgs args = new ControlGraphicsInfoArgs(viewInfo, cache, bounds); BaseCheckObjectInfoArgs ci = ((CheckEditViewInfo)args.ViewInfo).CheckInfo; Rectangle retValue = new Rectangle(bounds.X, ci.GlyphRect.Y, ci.GlyphRect.Width, ci.GlyphRect.Height); return(retValue); }
private static void DrawHeaderCheckBox(RepositoryItemCheckEdit checkItem, Graphics g, Rectangle r, bool Checked) { CheckEditViewInfo _info; CheckEditPainter _painter; ControlGraphicsInfoArgs _args; _info = checkItem.CreateViewInfo() as CheckEditViewInfo; _painter = checkItem.CreatePainter() as CheckEditPainter; _info.EditValue = Checked; _info.Bounds = r; _info.PaintAppearance.ForeColor = Color.Black; _info.CalcViewInfo(g); _args = new ControlGraphicsInfoArgs(_info, new DevExpress.Utils.Drawing.GraphicsCache(g), r); _painter.Draw(_args); _args.Cache.Dispose(); }
/// <summary> /// 画GridControl首列复选框 /// </summary> /// <param name="g"></param> /// <param name="r"></param> /// <param name="Checked"></param> protected void DrawCheckBox(Graphics g, Rectangle r, bool Checked) { DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo info; DevExpress.XtraEditors.Drawing.CheckEditPainter painter; DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs args; RepositoryItemCheckEdit chkEdit = new RepositoryItemCheckEdit(); info = chkEdit.CreateViewInfo() as DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo; painter = chkEdit.CreatePainter() as DevExpress.XtraEditors.Drawing.CheckEditPainter; info.EditValue = Checked; info.Bounds = r; info.PaintAppearance.ForeColor = Color.Black; info.CalcViewInfo(g); args = new DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(g), r); painter.Draw(args); args.Cache.Dispose(); }
protected void DrawCheckBox(Graphics g, Rectangle r, bool Checked) { var info = _edit.CreateViewInfo() as CheckEditViewInfo; var painter = _edit.CreatePainter() as CheckEditPainter; if (info != null) { info.EditValue = Checked; info.Bounds = r; info.CalcViewInfo(g); var args = new ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(g), r); if (painter != null) { painter.Draw(args); } args.Cache.Dispose(); } }
protected void DrawCheckBox(Graphics g, Rectangle r, bool Checked, bool Grayed) { DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo info = default(DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo); DevExpress.XtraEditors.Drawing.CheckEditPainter painter = default(DevExpress.XtraEditors.Drawing.CheckEditPainter); DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs args = default(DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs); info = (DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo)_CheckEdit.CreateViewInfo(); painter = (DevExpress.XtraEditors.Drawing.CheckEditPainter)_CheckEdit.CreatePainter(); if (Grayed) { info.EditValue = _CheckEdit.ValueGrayed; } else { info.EditValue = Checked; } info.Bounds = r; info.CalcViewInfo(g); args = new DevExpress.XtraEditors.Drawing.ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(g), r); painter.Draw(args); args.Cache.Dispose(); }
void DrawCheckBox(Graphics g, Rectangle r, bool chk, bool colHeader) { CheckEditViewInfo info = (edit.CreateViewInfo() as CheckEditViewInfo); CheckEditPainter painter = (edit.CreatePainter() as CheckEditPainter); ControlGraphicsInfoArgs args; info.EditValue = chk; if (colHeader) { r.Height += 20; } else { r.Width += 40; } info.Bounds = r; info.CalcViewInfo(g); args = new ControlGraphicsInfoArgs(info, new DevExpress.Utils.Drawing.GraphicsCache(g), r); painter.Draw(args); args.Cache.Dispose(); }