Dev Express 经验
1.格式化行
private void moGridView_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e) { var moView = moGridView.GetRow(e.RowHandle) as MOView; if (moView != null) { if (moView.IsDeleted) {//已删除 e.Appearance.Font = new Font(AppearanceObject.DefaultFont, FontStyle.Strikeout); e.Appearance.ForeColor = SystemColors.ControlDark; } else if (moView.DocState == DocState.Complete) {//已完工 e.Appearance.BackColor = Color.Gray; e.Appearance.ForeColor = Color.White; } } }
如何知道 devexpress gridview 的垂直滚动条何时到达终点?
检查最后一行是否可见
if (gridView1.IsRowVisible(gridView1.DataRowCount - 1) == RowVisibleState.Visible) //Do stuff
工具栏,创建下拉单选菜单
/// <summary> /// 创建计划条显示文本菜单 /// </summary> private void CreatePlanDisplayGroupContextMenu() { planDisplayGroupBarSubItem.ClearLinks(); foreach (var item in m_PlanDisplayGroups) { BarCheckItem barCheckItem = new BarCheckItem(); barCheckItem.CheckedChanged += BarCheckItem_CheckedChanged; barCheckItem.Caption = item.GroupName; barCheckItem.Tag = item; barCheckItem.Checked = false; barCheckItem.GroupIndex = 1;//同一组,支持单选 planDisplayGroupBarSubItem.AddItem(barCheckItem); } var barItemLink = planDisplayGroupBarSubItem.AddItem(planDisplayGroupTextBarButtonItem); barItemLink.BeginGroup = true; }