1:UltraGrid风格设置函数
public static void ColorGrid(ref Infragistics.Win.UltraWinGrid.UltraGrid dgd)
{
//标题
dgd.DisplayLayout.CaptionAppearance.TextHAlign=Infragistics.Win.HAlign.Left;
dgd.DisplayLayout.CaptionAppearance.BackColor=Color.LightSteelBlue;
//边框显示
dgd.DisplayLayout.BorderStyle=Infragistics.Win.UlElementBorderStyle.Solid;
//背景色
dgd.DisplayLayout.Appearance.BackColor=Color.White;
//默认颜色设置
dgd.DisplayLayout.Override.HeaderAppearance.BackColor=Color.LightSteelBlue;//列
dgd.DisplayLayout.Override.RowSelectorAppearance.BackColor=Color.LightSteelBlue;
//选中颜色设置
dgd.DisplayLayout.Override.SelectedCellAppearance.BackColor=Color.SteelBlue;//选中单元格
dgd.DisplayLayout.Override.SelectedRowAppearance.BaceColor=Color.SteelBlue;//选中行
//ActiveRowx颜色设置
dgd.DisplayLayout.Override.ActiveRowAppearance.BackColor=Color.SteelBlue;
}
2:UltraGrid删除选中的行
this.ultraGrid1.DeleteSelectedRows(false);
3:委托
this.ultraGrid1.AfterCellUpdate-=new Infragistics.Win.UltraWinGrid.CellEventHandler(this.ultraGrid1_AfterCellUpdate);
this.ultraGrid1.Rows[0].Cells["字段名"].Value="";
this.ultraGrid1.AfterCellUpdate+=new Infragistics.Win.UltraWinGrid.CellEventHandler(this.ultrGrid1_AfterCellUpdate);
4:判断
e.Cell.Column.Key=="字段名";
5:判断某列是否重复
public static bool CheckIfSame(UltraGrid ug, string colname)
{
for(int i = 0; i < ug.Rows.Count; i++)
{
for(int j = i+1; j < ug.Rows.Count; j++)
{
if(ug.Rows[i].Cells[colname].Text == ug.Rows[j].Cells[colname].Text && ug.Rows[i].Cells[colname].Text != "")
{
return true;
}
}
}
return false;
}
6: Enter切换,在form_load事件里写
this.ultraGrid1.KeyActionMappings.Add(new Infragistics.Win.UltraWinGrid.GridKeyActionMapping(System.Windows.Forms.Keys.Enter,
Infragistics.Win.UltraWinGrid.UltraGridAction.NextCell,Infragistics.Win.UltraWinGrid.UltraGridState.Is Checkbox,Infragistics.Win.UltraWinGrid.UltraGridState.Cell, 0, 0));
7: 选中一行
this.ultraGrid1.Rows[i].Activate();
this.ultraGrid1.Rows[i].Selected = true;
随机推荐
- mysql之触发器before和after的区别
我们先做个测试: 接上篇日志建的商品表g和订单表o和触发器 假设:假设商品表有商品1,数量是10: 我们往订单表插入一条记录: insert into o(gid,much) values(1,20) ...
- springday03-go2
新建springmvc01项目1.创建项目,导入jar包 拷贝jar/spring/first下的五个spring的jar包,以及jar/spring/mvc下的两个mvcjar包放在lib下 2.创 ...
- springmvc处理ajax请求
1.controller将数据封装成json格式返回页面 @RequestMapping("/dataList") public void datalist(CsoftCunsto ...
- 前端单页应用SEO解决方案
在这里只会提到Google的解决方案,日后再补充百度的解决方案 我们经常使用的单页都是#!来做应用的前端路由,因为这个在多个版本浏览器上有很好的兼容性 当Google发现URL里有#!符号,Googl ...
- Openstack的mysql数据多主galera的错误
登录openstack的在dashboard,提示说权限验证错误,有2种情况: 1. 密码被人改了. 2. 系统发生了问题. 密码确认没人改,所以查看/var/log/keystone-all.log ...
- eclipse折叠快捷键
之前按代码折叠快捷键的时候发现时而灵时而不灵,今天突然发现了问题所在: 按ctrl+/(小键盘)使代码左边出现折叠标志 然后再按ctrl+shift+/(折叠) , ctrl+shift+*(展开 ...
- java网络编程之UDP通讯
详细介绍了java中的网络通信机制,尤其是UDP协议,通过对UDP的基本使用进行举例说明如何使用UDP进行数据的发送接收,并举了两个小demo说明UDP的使用注意事项. UDP协议原理图解: UDP协 ...
- Shell之while循环
While循环的格式: while expression do command command ... done 1.计数器控制的while循环:主要用于已经准确知道要输入的数据和字符串的数目. 例子 ...
- iOS学习之Table View的简单使用
Table View简单描述: 在iPhone和其他iOS的很多程序中都会看到Table View的出现,除了一般的表格资料展示之外,设置的属性资料往往也用到Table View,Table View ...
- ecshop后台通过ajax搜索原理
ecshop的搜索其实是功能十分强大的,但是ecshop搜索功能前台和后台还不大一样,前台主要是通过get方式,提交的url进行分页,而在ecshop的后台,则是接受表单的搜索条件,然后通过js发布到 ...