GridControl摘录

gvCabTotalInfo.Columns["出线平均<br>电压"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Average;
gvCabTotalInfo.Columns["出线平均<br>电压"].SummaryItem.DisplayFormat = "平均:{0:N2}";
gvCabTotalInfo.RefreshDataSource();

Dev控件GridControl,怎样复制选中行焦点单元格的值?

optionBehavior-CopyToClipboardWithColumnHeader=false;optionSelection-MultiSelectMode=CellSelect;然后Ctrl-c就可以了

 

private void AdvBandedGridView1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
    if (e.Control & e.KeyCode == Keys.C) {
        Clipboard.SetDataObject(AdvBandedGridView1.GetFocusedRowCellValue(AdvBandedGridView1.FocusedColumn));
        e.Handled = true;
    }
}

 

如何显示水平滚动条? 

设置 this.gridView.OptionsView.ColumnAutoWidth = false;

 

.....列表宽度自适应内容

gridview1.BestFitColumns();

 

如何定位到第一条数据/记录? 

设置 this.gridView.MoveFirst()

如何定位到最后一条数据/记录? 

设置 this.gridView.MoveLast()

 

设置成一次选择一行,并且不能被编辑 

this.gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus; 

 this.gridView1.OptionsBehavior.Editable = false; 

this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;

 

如何让各列头禁止移动? 

设置 gridView1.OptionsCustomization.AllowColumnMoving = false;

 

.拖动滚动条时固定某一列

 设置Columns,选择要固定的列。设置Fixed属性,可以选择:固定在左边、固定在右边、不固定

 

设某一列文字和标题局中显示                  
   gridView1.Columns[0].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
   gridView1.Columns[0].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

 

隔行换色的方法
this.gridView1.Appearance.OddRow.BackColor = Color.White; // 设置奇数行颜色 // 默认也是白色 可以省略
this.gridView1.OptionsView.EnableAppearanceOddRow = true; // 使能 // 和和上面绑定 同时使用有效
this.gridView1.Appearance.EvenRow.BackColor = Color.WhiteSmoke; // 设置偶数行颜色
this.gridView1.OptionsView.EnableAppearanceEvenRow = true; // 使能 // 和和上面绑定 同时使用有效

 


源文:http://www.cnblogs.com/YanZhiwei/p/3214647.html    [DevExpress]关于GridControl中SummaryItem使用总结 /12.1版本

 https://yq.aliyun.com/wenzhang/show_119544    Dev控件GridControl,怎样复制选中行焦点单元格的值?

http://www.cnblogs.com/yuerdongni/archive/2012/09/08/2676753.html    DEV GridControl小结。。

 

posted @ 2017-09-21 15:43  BloggerSb  阅读(203)  评论(0编辑  收藏  举报