1个回答
展开全部
在gridControl的gridView中将属性OptionsSelection.MultiSelect 设置为True,
下面是我自己写的dev gridControl下gridView的样式类,注释较多,可以参考
/// <summary>
/// 设置girdView默认属性
/// </summary>
/// <param name="gv"></param>
public static void SetStyle(DevExpress.XtraGrid.Views.Grid.GridView gv)
{
/*
* author:wxm
* date :2014年7月25日10:59:08
* */
gv.OptionsView.ShowGroupPanel = false; //不允许自定义分组
gv.RowHeight = 22; //行高22
gv.OptionsView.ShowFooter = false; //不显示页脚
//表头行高设置为24、分组行高设置为35(为仅有一级分组的行高)
gv.ColumnPanelRowHeight = 24;
gv.GroupRowHeight = 35;
//列表中最前面的空白列的宽度设置为12
gv.IndicatorWidth = 12;
//设置列表是否多选、多选的模式(行或单元格)、选择的行或单元格背景是否倒置
gv.OptionsSelection.MultiSelect = false;
gv.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect;
gv.OptionsSelection.InvertSelection = false;
gv.OptionsSelection.EnableAppearanceFocusedCell = false;
//允许编辑
gv.OptionsBehavior.Editable = true;
//不显示分组面板
gv.OptionsView.ShowGroupPanel = false;
//不允许用户进行过滤和分组
gv.OptionsCustomization.AllowFilter = false;
gv.OptionsCustomization.AllowGroup = false;
//允许用户拖动列和不允许进行列排序
gv.OptionsCustomization.AllowColumnMoving = true;
gv.OptionsCustomization.AllowSort = false;
//列标题垂直居中
gv.Appearance.HeaderPanel.Options.UseTextOptions = true;
gv.Appearance.HeaderPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
gv.Appearance.HeaderPanel.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
//将数据行内容垂直,文字左对齐,数字右对齐
//gv.Appearance.Row.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
//gv.Appearance.Row.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
//HAlignment(水平位置):Far(数字右对齐)/Near(文字、日期左对齐)
//不显示右键菜单
gv.OptionsMenu.EnableColumnMenu = false;
//自动过滤时不显示过滤记录
gv.OptionsView.ShowFilterPanelMode = DevExpress.XtraGrid.Views.Base.ShowFilterPanelMode.Never;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询