Example #1
0
        public void deleteData(MListItem item)
        {
            if (item == null)
            {
                return;
            }

            this.Controls.Remove(item);
            max--;
            loadNewData(0);
        }
Example #2
0
 /// <summary>
 /// 初始化内容
 /// </summary>
 public void initListContent()
 {
     for (int i = 0; i < unit; i++)
     {
         MListItem item = new MListItem(i);
         item.Location            = new Point(0, item.Height * i);
         item.onMItemClick       += onItemClick;
         item.onDeleteMItemClick += deleteData;
         mBtn += item.buttonMove;
         this.Controls.Add(item);
     }
 }
Example #3
0
 public void onItemClick(int index)
 {
     iss(index);
     foreach (Control conItem in this.Controls)
     {
         if (!(conItem is MListItem))
         {
             return;
         }
         MListItem item = (MListItem)conItem;
         item.backGroundChange(index);
     }
 }
Example #4
0
        /// <summary>
        /// 加载新数据
        /// </summary>
        /// <param name="lastPosition">最后一条记录的位置</param>
        public void loadNewData(int lastPosition)
        {
            this.Controls.Clear();
            removeItem();
            int currentSize = this.Controls.Count;

            for (int i = 0; i < max; i++)
            {
                MListItem item = new MListItem(currentSize + i);
                item.onMItemClick       -= onItemClick;
                item.Location            = new Point(0, item.Height * i + lastPosition);
                item.onMItemClick       += onItemClick;
                item.onDeleteMItemClick += deleteData;
                this.Controls.Add(item);
                mBtn += item.buttonMove;
            }
        }
Example #5
0
        /// <summary>
        /// 加载新数据
        /// </summary>
        /// <param name="lastPosition">最后一条记录的位置</param>
        public void loadNewData(List <CenJiBean> cenJiFileData)
        {
            List <CenJiBean> cenJiData = cenJiFileData.ToList();

            removeItem();

            int count = cenJiData.Count;

            max = count;
            for (int i = 0; i < count; i++)
            {
                MListItem item = new MListItem(i, cenJiData[i].CenJiName);
                item.onMItemClick       -= onItemClick;
                item.Location            = new Point(0, item.Height * i);
                item.onMItemClick       += onItemClick;
                item.onDeleteMItemClick += deleteData;
                mBtn += item.buttonMove;
                this.Controls.Add(item);
            }
        }
Example #6
0
        private void removeItem()
        {
            //this.Controls.Clear();

            if (this.Controls.Count > 0)
            {
                for (int i = 0; i < this.Controls.Count; i++)
                {
                    if (!(this.Controls[i] is MListItem))
                    {
                        continue;
                    }
                    MListItem item = this.Controls[i] as MListItem;
                    item.onMItemClick       -= onItemClick;
                    item.onDeleteMItemClick -= deleteData;
                    mBtn -= item.buttonMove;

                    //Control C = this.Controls[i];
                    this.Controls.Remove(item);
                    item.Dispose();
                }
            }
        }