当前位置: 首页 > news >正文

win7电脑做网站小红书seo排名

win7电脑做网站,小红书seo排名,centos7搭建wordpress,昆明商城网站建设阅读全文并下载例子 #xff1a;http://www.sufeinet.com/forum.php?modviewthreadtid190 以前不都是用table直接绑定DataGridView的#xff0c;没有出现过不能排序的问题#xff0c;初试List结果发现不管怎么样都不能实现排序的功能#xff0c;有朋友说 DataGridVie…   阅读全文并下载例子 http://www.sufeinet.com/forum.php?modviewthreadtid190   以前不都是用table直接绑定DataGridView的没有出现过不能排序的问题初试List结果发现不管怎么样都不能实现排序的功能有朋友说 DataGridView每一列都有个Sortable默认Automatic改成NotSortable了结果怎样还是不行啦。      还有朋友说 你可以拖一个bindingsource控件. bindingsource.datasource泛型集合 datagridview.datasourcebindingsource; 我发现也是不行那要怎么办呢查一下资料才知道     用泛型会失去DateTable的特性要实现System.Collections.Generic.IComparerT 才能实现排序  没有办法只能实现 一把了   看一下下面的代码吧 基本 是这样的 代码 using System;using System.ComponentModel;using System.Collections.Generic;using System.Reflection;namespace BaseFunction{    class ObjectPropertyCompareT : System.Collections.Generic.IComparerT     {        private PropertyDescriptor property;        private ListSortDirection direction;        public ObjectPropertyCompare(PropertyDescriptor property, ListSortDirection direction)        {            this.property  property;            this.direction  direction;        }        #region IComparerT        /// summary        /// 比较方法        /// /summary        /// param namex相对属性x/param        /// param namey相对属性y/param        /// returns/returns        public int Compare(T x, T y)        {            object xValue  x.GetType().GetProperty(property.Name).GetValue(x, null);            object yValue  y.GetType().GetProperty(property.Name).GetValue(y, null);            int returnValue;            if (xValue is IComparable)            {                returnValue  ((IComparable)xValue).CompareTo(yValue);            }            else if (xValue.Equals(yValue))            {                returnValue  0;            }            else            {                returnValue  xValue.ToString().CompareTo(yValue.ToString());            }            if (direction  ListSortDirection.Ascending)            {                return returnValue;            }            else            {                return returnValue * -1;            }        }        public bool Equals(T xWord, T yWord)        {            return xWord.Equals(yWord);        }        public int GetHashCode(T obj)        {            return obj.GetHashCode();        }        #endregion    }}   在实现了这个接口之后还不能急我们还要来写一个SortableBindingList T :BindingList T 的类用来绑定数据 基本实现   代码 using System;using System.ComponentModel;using System.Collections.Generic;using System.IO;using System.Runtime.Serialization.Formatters.Binary;using System.Text;namespace BaseFunction{    public class BindingCollectionT : BindingListT    {        private bool isSorted;        private PropertyDescriptor sortProperty;        private ListSortDirection sortDirection;        protected override bool IsSortedCore        {            get { return isSorted; }        }        protected override bool SupportsSortingCore        {            get { return true; }        }        protected override ListSortDirection SortDirectionCore        {            get { return sortDirection; }        }        protected override PropertyDescriptor SortPropertyCore        {            get { return sortProperty; }        }        protected override bool SupportsSearchingCore        {            get { return true; }        }        protected override void ApplySortCore(PropertyDescriptor property, ListSortDirection direction)        {            ListT items  this.Items as ListT;            if (items ! null)            {                ObjectPropertyCompareT pc  new ObjectPropertyCompareT(property, direction);                items.Sort(pc);                isSorted  true;            }            else            {                isSorted  false;            }            sortProperty  property;            sortDirection  direction;            this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));        }        protected override void RemoveSortCore()        {            isSorted  false;            this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));        }        //排序        public void Sort(PropertyDescriptor property, ListSortDirection direction)        {            this.ApplySortCore(property, direction);        }    }}   现 在应该流到怎么使用了其实很简单 直接  BindingCollectionobject  objList  new BindingCollectionobject(); objList 你的结果集; this.dataGridView1.DataSource  objList;   但是现在是问题是我的之前用的是List不想改而且调用的是Dll人家返回的就是一个List我没有办法改成BindingCollectionobject 啊。 想了半天还是想出来了只是不知道 在性能和别的方面怎么样所以把代码发上来大家讨论一下 我是这样实现 的 代码  //可以实现排序的类            BindingCollectionhistoryorderInfo objList  new BindingCollectionhistoryorderInfo();            //加载数据            foreach (historyorderInfo item in tmpList)            {                objList.Add(item);            }            dgvhistory.DataSource  objList;     这里的tmpList就是我之前使用的系统原本的List,我是使用了 foreach 把原来的数据导入到BindingCollection中的。 这样的确定是可以实现 我想要的效果的。不知道这样做有什么不到之处。希望能得到高人的指点啊呵呵  转载于:https://www.cnblogs.com/sufei/archive/2010/02/04/1663125.html
http://www.yutouwan.com/news/472051/

相关文章:

  • 什么网站可以免费做兼职长沙建网站需要多少钱
  • 网站会员发展计划成免费的crm图片
  • 企业建设网站需注意哪些事项泗水网站建设
  • 如何检测网站开发商留有后门线上广告形式有哪些
  • 北京电子商务app网站建设大兴陕西西安网站建设公司
  • 淄川区住房和城乡建设局网站互联网保险平台哪家最好
  • 怎么做网站链接爆破wordpress密码
  • 大连网站建设找哪家好熊岳网站在哪做
  • 佛山网站建设原创在线美图
  • 中国建设银行抚州分行网站网页设计参考书籍
  • 新泰网站开发建一个论坛网站要多少钱
  • 网站建站金融模板微商城建设
  • 宣城市住房和城乡建设局网站设计手机网站页面尺寸大小
  • 大学生网站开发接单怎么打开wordpress
  • 成都网站建设著名公司做网络推广怎么找客户
  • 北京做网站的大公司上海新闻综合频道直播
  • 中国医院建设协会网站首页长沙装修公司联系电话
  • 什么网站做品牌特卖2015年做那个网站致富
  • 毕业生网站建设方案书棋牌软件开发
  • 企业网站seo案例分析中英文版网站建设
  • 佛山市企业网站建设平台成都网站建设收费明细
  • 网站优化招商网站建设龙头股
  • 自己做的宫崎骏动漫网站wordpress游客发帖插件
  • wordpress网站文件管理wordpress如何设置注册用户名大于4个字符
  • 深圳做微信网站毛绒玩具东莞网站建设
  • 烟台网站开发丹东做网站的公司
  • 室内设计网站知乎网上举报平台
  • 一学一做教育视频网站新浪云 wordpress
  • 淘宝客网站做百度推广鹤壁seo推广
  • 凡客vancl的网站标题网站建设与管理维护