快乐的果栋

C#/Asp.net/WinForm
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

贼菜的小技能

Posted on 2009-01-17 14:55  Create  阅读(290)  评论(0)    收藏  举报
 

 给下拉列表框填充数据库中的信息

this.comboBox1.DisplayMember = "绑定的字段名";(显示给用户的信息)

 this.comboBox1.ValueMember = "绑定的字段名";(数据库中实际用的)

this.comboBox1.DataSource = ds.Tables["bg_classify"];

  设置列值的名值转换,数据字典

private void DataMapStatus()

        {

        Hashtable hashDataMap = new Hashtable();

            hashDataMap.Clear();

            hashDataMap.Add("1", "审核");

            hashDataMap.Add("2", "审批");

            hashDataMap.Add("3", "批复");

            hashDataMap.Add("4", "作废");

            hashDataMap.Add("5", "已完成");

        }

this.DirectListInsta.Grid.Cols["STATUS"].DataMap = hashDataMap; 

判断某年某月的天数

DateTime.DaysInMonth(yourYear,yourMonth); 

FixGrid指定方法

设置指定列的背景色 方法一

this.uiDirectVoucher1.Grid.Cols["SCHECK_PERSON"].StyleDisplay.BackColor = Color.Green;

设置指定列的背景色 方法二

CellStyle s = _flex.Styles.Add("MyStyle");
s.BackColor = Color.Red;
s.ForeColor = Color.White;

flex.Cols[3].Style = _flex.Styles["MyStyle"];

 

设置指定行的背景色

CellStyle s1 = this.uiVoucher.Grid.Styles.Add("NewStyle");

s1.ForeColor = Color.Red;

CellStyle s2 = this.uiVoucher.Grid.Styles.Add("OldStyle");

s2.ForeColor = Color.Black;