private void gridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridGroupRowInfo GridGroupRowInfo = e.Info as GridGroupRowInfo; int id = int.Parse(GridGroupRowInfo.EditValue.ToString()); GridGroupRowInfo.GroupText = $"{nameDic[id]}({returns.Count(t=>t.Code==id)})"; }
private void bandedGridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { BandedGridView view = sender as BandedGridView; GridGroupRowInfo info = e.Info as GridGroupRowInfo; if (info.Column == colANA_GRUP) { var text = view.GetGroupSummaryText(e.RowHandle); text = Convert.ToDecimal(text.Substring(0, text.IndexOf(",")).Replace(" ", "")).ToString("N2"); info.GroupText = "<color=Maroon>" + info.GroupValueText + "</color> " + " : "; info.GroupText += "<color=blue>" + text + "</color> "; } if (info.Column == colGRUP) { var text = view.GetGroupSummaryText(e.RowHandle); var firstIndex = text.IndexOf(","); var lastIndex = text.LastIndexOf(","); text = text.Substring(0, text.LastIndexOf(",")); text = Convert.ToDecimal(text.Substring(text.IndexOf(",") + 1).Replace(" ", "")).ToString("N2"); info.GroupText = "<color=Maroon>" + info.GroupValueText + "</color> " + " : "; info.GroupText += "<color=green>" + text + "</color> "; } if (info.Column == colCARI_KODLAR) { var text = view.GetGroupSummaryText(e.RowHandle); var lst = text.LastIndexOf(","); text = Convert.ToDecimal(text.Substring(text.LastIndexOf(",") + 1).Replace(" ", "")).ToString("N2"); info.GroupText = "<color=Maroon>" + info.GroupValueText + "</color> " + " : "; info.GroupText += "<color=black>" + text + "</color> "; } }
void gridView1_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e) { GridGroupRowInfo info = (GridGroupRowInfo)e.Info; string groupText = info.GroupText; info.GroupText = "[#image]"; //default drawing _GridPainter.ElementsPainter.GroupRow.DrawGroupRowBackground(e.Info); ObjectPainter.DrawObject(e.Cache, _GridPainter.ElementsPainter.GroupRow, e.Info); info.GroupText = groupText; //draw caption Rectangle bounds = info.ButtonBounds; bounds.X = bounds.Right + 20; bounds.Width = info.Bounds.Right - bounds.Right - progressBarWidth; bounds.Offset(progressBarWidth, 0); info.CreateEditorInfo(bounds, info.Appearance.GetForeColor()); ObjectPainter.DrawObject(e.Cache, info.CreatePainter(), info.EditorInfo); //draw progressbar bounds = info.ButtonBounds; bounds.X = bounds.Right + 5; bounds.Width = progressBarWidth; bounds.Inflate(0, 2); ProgressBarBaseViewInfo vi = CreateViewInfo(bounds, (float)0.50, e.Graphics); ControlGraphicsInfoArgs args = new ControlGraphicsInfoArgs(vi, e.Cache, bounds); _PBPainter.Draw(args); e.Handled = true; }
void OnMouseMove(object sender, MouseEventArgs e) { GridHitInfo hitInfo = view.CalcHitInfo(e.Location); if (hitInfo.HitTest == GridHitTest.Row && view.IsGroupRow(hitInfo.RowHandle)) { GridViewInfo viewInfo = view.GetViewInfo() as GridViewInfo; GridGroupRowInfo rowInfo = viewInfo.GetGridRowInfo(hitInfo.RowHandle) as GridGroupRowInfo; GridColumn col = viewInfo.GetNearestColumn(e.Location); GridColumnInfoArgs args = viewInfo.ColumnsInfo[col]; if (col.VisibleIndex == 0) { HotTrackRectangle = new Rectangle(rowInfo.ButtonBounds.Right + 2, rowInfo.Bounds.Y, args.Bounds.Width + args.Bounds.X - rowInfo.ButtonBounds.Right - 2, rowInfo.Bounds.Height); } else { HotTrackRectangle = new Rectangle(args.Bounds.X + 2, rowInfo.Bounds.Y, args.Bounds.Width - 2, rowInfo.Bounds.Height); } } else { HotTrackRectangle = Rectangle.Empty; } }
private static void DrawFormattedString(GridGroupRowInfo info, Point textPos) { var text = GetCustomDisplayText(info.GroupValueText); var textFont = new Font(info.Appearance.Font, FontStyle.Italic | FontStyle.Bold); var textBrush = new SolidBrush(Color.FromArgb(0x00, 0x66, 0x00)); info.Cache.Paint.DrawString(info.Cache, text, textFont, textBrush, textPos); }
private void DrawGroupRow(DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e, GridViewInfo viewInfo) { GridGroupRowInfo rowInfo = e.Info as GridGroupRowInfo; GridGroupRowPainter painter = e.Painter as GridGroupRowPainter; rowInfo.ButtonBounds = GetButtonRectangle(rowInfo.ButtonBounds, viewInfo); painter.ElementsPainter.GroupRow.DrawObject(rowInfo); }
private static void DrawGradientBackground(RowObjectCustomDrawEventArgs e, GridGroupRowInfo info) { var linGrBrush = new LinearGradientBrush(info.DataBounds, Color.FromArgb(0xFF, 0xFF, 0x99), Color.FromArgb(0x00, 0xCC, 0x00), 45); e.Cache.FillRectangle(linGrBrush, info.DataBounds); }
private void xgtGridView_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridView view = sender as GridView; GridGroupRowInfo info = e.Info as GridGroupRowInfo; //info.GroupText = view.GetRowCellValue(e.RowHandle, colVAL).ToString(); GenelDataSet.XGTRow xgtRow = this.genelDataSet.XGT.FindByGRPID(info.EditValue.ToString(), "+"); info.GroupText = xgtRow.VAL; }
private void gridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { int index = gridView1.GetDataRowHandleByGroupRowHandle(e.RowHandle); if (dsw.IsCustomItemIndex(index)) { GridGroupRowInfo info = e.Info as GridGroupRowInfo; info.GroupText = "Custom Rows"; } }
public int CalcGroupRowTextWidth(RowObjectCustomDrawEventArgs args) { GridGroupRowInfo rowInfo = args.Info as GridGroupRowInfo; if (rowInfo == null) { return(0); } return((int)rowInfo.Paint.CalcTextSize(args.Graphics, rowInfo.GroupText, rowInfo.Appearance.Font, new StringFormat(), 0).Width); }
private void gridViewGroupList_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridGroupRowInfo GridGroupRowInfo = e.Info as GridGroupRowInfo; GridView gridview = sender as GridView; int index = gridview.GetDataRowHandleByGroupRowHandle(e.RowHandle); GridGroupRowInfo.GroupText = "名称:" + gridview.GetRowCellValue(index, "分组名称").ToString() + ",备注:" + gridview.GetRowCellValue(index, "分组备注").ToString(); }
private void GridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridGroupRowInfo info = e.Info as GridGroupRowInfo; GridView view = sender as GridView; if (info.Column == colCHUCVU) { info.GroupText = info.GroupValueText + " (Số lượng = " + gridView1.GetChildRowCount(e.RowHandle) + ")"; } }
private void gridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridGroupRowInfo info = e.Info as GridGroupRowInfo; if (info == null) { return; } //info.GroupText = info.GroupText.Replace("1 items", "1 item"); }
private void gridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridColumn cl = (GridColumn)dgvViewHD.dgvGridView.Columns["MA_CTKM"]; GridGroupRowInfo info = e.Info as GridGroupRowInfo; if (info.Column == cl) { info.GroupText = "Ship country starts with " + info.GroupValueText; } }
private void gvData_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridGroupRowInfo GridGroupRowInfo = e.Info as GridGroupRowInfo; int pos = GridGroupRowInfo.GroupText.LastIndexOf(":"); if (pos >= 0) { GridGroupRowInfo.GroupText = GridGroupRowInfo.GroupText.Substring(pos + 1); } }
private void ReqListView_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridGroupRowInfo info = e.Info as GridGroupRowInfo; if (info.Column.Name == "colCostCentre") { info.GroupText = info.GroupValueText; e.Appearance.ForeColor = Color.Blue; e.Appearance.Font = new Font("Verdana", 9, FontStyle.Bold); } }
private static void DrawExpandButton(RowObjectCustomDrawEventArgs e, GridGroupRowInfo info, GridView view, DevExpress.LookAndFeel.UserLookAndFeel lookAndFeel) { Image img = GetExpandButtonImage(e, view, lookAndFeel); if (img == null) { return; } var imgLocation = new Point(info.ButtonBounds.Location.X + (info.ButtonBounds.Width - img.Width) / 2, info.ButtonBounds.Location.Y + (info.ButtonBounds.Height - img.Height) / 2); info.Cache.Paint.DrawImage(e.Cache.Graphics, img, new Rectangle(imgLocation, img.Size)); }
private void opmclGridView_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridView view = sender as GridView; view.GetGroupRowDisplayText(e.RowHandle); GridGroupRowInfo info = e.Info as GridGroupRowInfo; if (string.IsNullOrWhiteSpace(info.GroupValueText)) { info.GroupText = "Not Loaded"; } }
private void EventGroup(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridView view = sender as GridView; GridGroupRowInfo info = e.Info as GridGroupRowInfo; string caption = info.Column.Caption; if (info.Column.Caption == string.Empty) { caption = info.Column.ToString(); } info.GroupText = string.Format("{0} : {1} (count= {2})", caption, info.GroupValueText, view.GetChildRowCount(e.RowHandle)); }
void View_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e) { GridGroupRowInfo info = e.Info as GridGroupRowInfo; info.GroupText = " " + info.GroupText.TrimStart(); e.Info.Paint.FillRectangle(e.Cache.Graphics, e.Appearance.GetBackBrush(e.Cache), e.Bounds); e.Painter.DrawObject(e.Info); Rectangle r = info.ButtonBounds; r.Offset(r.Width + CheckboxIndent * 2 - 1, 0); DrawCheckBox(e.Cache.Graphics, r, IsGroupRowSelected(e.RowHandle)); e.Handled = true; }
private void viewTrain_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridView view = sender as GridView; GridGroupRowInfo info = e.Info as GridGroupRowInfo; int numElement = view.GetChildRowCount(e.RowHandle); int rowHdl = view.GetChildRowHandle(e.RowHandle, 0); if (rowHdl >= 0) { TrainFilesCarrier.TrainFileRow dataRow = view.GetDataRow(rowHdl) as TrainFilesCarrier.TrainFileRow; info.GroupText = String.Format(" {0} - {1}", dataRow.Word, numElement); } }
private void gridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridGroupRowInfo info = e.Info as GridGroupRowInfo; if (info == null) { return; } if (info.Column.FieldName == "orderPrice") { string interval = IntervalByValue(gridView1.GetGroupRowValue(info.RowHandle)); string sumText = gridView1.GetGroupSummaryText(info.RowHandle); info.GroupText = string.Format("order Price:{0}{1}", interval, sumText); } }
/// <summary> /// 标题栏改变 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridView1_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridGroupRowInfo GridGroupRowInfo = e.Info as GridGroupRowInfo; int id = int.Parse(GridGroupRowInfo.EditValue.ToString()); int count = videoplays.Count(t => t.EquipmentID == id); if (id == 0) { GridGroupRowInfo.GroupText = $"({(-e.RowHandle).ToString()})通道信息:" + GridGroupRowInfo.EditValue + ":无通道信息" + $"({count})"; } else { GridGroupRowInfo.GroupText = $"({(-e.RowHandle).ToString()})通道信息:" + GridGroupRowInfo.EditValue + ":" + mydic[id].Name + $"({count})" + $"({mydic[id].LabelStr})"; } }
private void gridView_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e) { GridView view = sender as GridView; object val = view.GetGroupRowValue(e.RowHandle); VisitCase visitCase = val != null && val is Guid? ObjectSpace.FindObject <VisitCase>(VisitCase.Fields.Oid == (Guid)val) : null; GridGroupRowInfo info = e.Info as GridGroupRowInfo; if (info.Column.FieldName == "Case.Oid") { info.GroupText = string.Format("Посещение {0} ({1})", visitCase.Num, visitCase != null && visitCase.MainDiagnose != null && visitCase.MainDiagnose.Diagnose != null ? visitCase.MainDiagnose.Diagnose.MKB : null); } }
private static Point DrawGroupRowCustomImage(RowObjectCustomDrawEventArgs e, GridGroupRowInfo info, GridView view, ImageList imgList) { var imgIndex = view.GetDataSourceRowIndex(e.RowHandle); Image img; img = GetGroupRowCustomImage(imgList, imgIndex); var imgPos = CalcImgPosition(e, info); if (img == null) { return(imgPos); } info.Cache.Paint.DrawImage(e.Cache.Graphics, img, imgPos); Point imageRightBottomCorner = new Point(imgPos.X + img.Width, imgPos.Y); return(imageRightBottomCorner); }
private void afbGridView_CustomDrawGroupRow(object sender, DevExpress.XtraGrid.Views.Base.RowObjectCustomDrawEventArgs e) { GridView view = sender as GridView; GridGroupRowInfo info = e.Info as GridGroupRowInfo; DevExpress.Data.GroupRowInfo dvzGrp = (info.RowKey as DevExpress.Data.GroupRowInfo); for (int i = info.Level; i > 0; i--) // Tersten Dvz'in gectigi Grubu bul { if (colBDVZb.GroupIndex == i) { break; } dvzGrp = dvzGrp.ParentGroup; } info.GroupText = info.GroupText.Replace("dvz", dvzGrp.GroupValue.ToString()); }
void view_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e) { GridGroupRowInfo info = (GridGroupRowInfo)(((CustomDrawObjectEventArgs)e).Info); Rectangle bounds = info.DataBounds; bounds.Offset(2, 0); string text = (bool)info.EditValue ? "Pinned" : "Recent"; e.Appearance.DrawString(e.Cache, text, bounds); SizeF size = e.Appearance.CalcTextSize(e.Cache, text, bounds.Width); bounds.Offset(size.ToSize().Width, 0); bounds.Width -= size.ToSize().Width; bounds.Inflate(-2, 0); Point point1 = new Point(bounds.X, bounds.Y + bounds.Height / 2); Point point2 = new Point(bounds.Right, bounds.Y + bounds.Height / 2); e.Cache.DrawLine(e.Cache.GetPen(e.Appearance.GetForeColor()), point1, point2); e.Handled = true; }
void ShowGroupEdit() { TextEdit te = new TextEdit(); this.View.GridControl.Controls.Add(te); rowToChangeHandle = this.View.FocusedRowHandle; GridViewInfo gvi = new GridViewInfo(this.View); Graphics g = this.View.GridControl.CreateGraphics(); gvi.Calc(g, this.View.ViewRect); GridGroupRowInfo info = gvi.RowsInfo.GetInfoByHandle(rowToChangeHandle) as GridGroupRowInfo; string newText = this.View.GetGroupRowValue(rowToChangeHandle).ToString(); te.Text = newText; te.Bounds = info.DataBounds; te.Visible = true; te.Focus(); te.SelectAll(); te.Leave += new System.EventHandler(this.textEdit_Leave); te.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textEdit_KeyDown); }
private Rectangle PreventSummaryTextOverlapping(RowObjectCustomDrawEventArgs e, Rectangle rect) { GridGroupRowInfo gInfo = (GridGroupRowInfo)e.Info; int groupTextLocation = gInfo.ButtonBounds.Right + 10; int groupTextWidth = TextUtils.GetStringSize(e.Cache.Graphics, gInfo.GroupText, e.Appearance.Font).Width; Rectangle r = new Rectangle(groupTextLocation, 0, groupTextWidth, e.Info.Bounds.Height); if (r.Right > rect.X) { if (r.Right > rect.Right) { rect.Width = 0; } else { rect.Width -= r.Right - rect.X; rect.X = r.Right; } } return(rect); }
void gridView1_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e) { GridGroupRowInfo rowInfo = e.Info as GridGroupRowInfo; if (rowInfo != null && rowInfo.Column.FieldName == "Rating") { MyGridView view = sender as MyGridView; MyGridViewInfo viewInfo = view.GetViewInfo() as MyGridViewInfo; int textWidth = viewInfo.CalcGroupRowTextWidth(e); RatingControlViewInfo info = rowInfo.Column.ColumnEdit.CreateViewInfo() as RatingControlViewInfo; RatingControlPainter painter = rowInfo.Column.ColumnEdit.CreatePainter() as RatingControlPainter; info.EditValue = view.GetGroupRowValue(e.RowHandle); info.CalcViewInfo(e.Graphics); info.Bounds = new Rectangle(textWidth, rowInfo.DataBounds.Y, info.RatingSize.Width, rowInfo.DataBounds.Height); info.CalcViewInfo(e.Graphics); ControlGraphicsInfoArgs args = new ControlGraphicsInfoArgs(info, e.Cache, rowInfo.DataBounds); e.DefaultDraw(); painter.Draw(args); e.Handled = true; } }