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 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 treeList1_CustomDrawNodeCell(object sender, DevExpress.XtraTreeList.CustomDrawNodeCellEventArgs e) { if (e.Column != treeList1.Columns["IMAGEINDEX"]) { return; } string caption = "Node ID: " + e.Node.Id.ToString(); DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo viewInfo = (e.EditViewInfo as DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo); DevExpress.Utils.Drawing.BaseCheckObjectInfoArgs checkInfo = viewInfo.CheckInfo; checkInfo.Caption = caption; checkInfo.Graphics = e.Graphics; viewInfo.CheckPainter.CalcObjectBounds(checkInfo); }
private void gvDevices_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e) { var dev = this.gvDevices.GetRow(e.RowHandle) as DataRowView; if (dev == null) { return; } if (e.Column == gvDevices.Columns[IS_SELECT]) { DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo viewInfo = ((e.Cell as GridCellInfo).ViewInfo as DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo); DevExpress.Utils.Drawing.CheckObjectInfoArgs checkInfo = (DevExpress.Utils.Drawing.CheckObjectInfoArgs)viewInfo.CheckInfo; checkInfo.Caption = dev[DEV_ID].ToString(); checkInfo.Graphics = e.Graphics; viewInfo.CheckPainter.CalcObjectBounds(checkInfo); return; } }
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(); }
private void gridView1_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column.Name == "colCheckIndicator") { string text; bool isChecked; GridView grid = sender as GridView; if (grid.IsEditing && e.RowHandle == grid.FocusedRowHandle && grid.FocusedColumn.FieldName == "Column1") { text = grid.ActiveEditor.Text; } else { text = grid.GetRowCellDisplayText(e.RowHandle, grid.Columns["Column1"]); } isChecked = (text != null && text != string.Empty); DevExpress.XtraGrid.Views.Grid.ViewInfo.GridCellInfo cell = (DevExpress.XtraGrid.Views.Grid.ViewInfo.GridCellInfo)e.Cell; DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo info = (DevExpress.XtraEditors.ViewInfo.CheckEditViewInfo)cell.ViewInfo; info.EditValue = isChecked; } }