⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 glistviewitemcollection.cs

📁 语音视频功能 里面实现了基本的QQ与语音对话
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Diagnostics;
using System.ComponentModel.Design;
using System.Drawing.Design;
namespace gowk.controls
{
	[Serializable]
	public class GListViewItemCollection:System.Collections.ArrayList
	{
		GListView gListView;
		GListViewItem parent;

		#region constructor
		protected GListViewItemCollection(GListView gListView)
		{
			Debug.Assert(null!=gListView);
			this.gListView=gListView;
		}
		public GListViewItemCollection(GListViewItem gitem)
		{
			this.parent=gitem;
		}
		#endregion


		public new GListViewItem this[int index]
		{
			get{return (GListViewItem)base[index];}
			set{base[index]=value;}
		}
		public GListViewItem this[string text]
		{
			get
			{
				foreach(GListViewItem item in this)
				{
					if(item.Text==text)return item;
				}
				return null;
			}
		}
        
		public GListView GListView
		{
			get
			{
				if(this.parent==null)
				{
					return this.gListView;
				}
				else
				{
					return this.parent.GListView;
				}
			}
		}



		public GListViewItem Parent
		{
			get{return this.parent;}
			set{this.parent=value;}
		}


		public override int Add(object value)
		{
			Debug.Assert(value!=null & value is GListViewItem);
			GListViewItem i=value as GListViewItem;
			i.parent=this.parent;
			i.gListView=this.GListView;
			int ret=base.Add (value);
			if(this.GListView!=null)
				this.GListView.OnItemAdded(new ItemEventArgs(i));
			return ret;
		}


		public override void AddRange(ICollection c)
		{
			if(c.Count<1)return;
			base.AddRange (c);
			foreach(GListViewItem i in c)
			{
				i.parent=this.parent;
				i.gListView=this.GListView;
				if(this.GListView!=null)
					this.GListView.OnItemAdded(new ItemEventArgs(i));
			}
		}

		public override void Remove(object obj)
		{
			if(obj==null)return;
			base.Remove (obj);
			if(this.GListView!=null)
				this.GListView.OnItemRemoved(new ItemEventArgs((GListViewItem)obj));
		}

		public override void RemoveAt(int index)
		{
			base.RemoveAt (index);
			if(this.GListView!=null)
				this.GListView.OnItemRemoved(new ItemEventArgs(this[index]));
		}
		public override void RemoveRange(int index, int count)
		{
			base.RemoveRange (index, count);
			for(int j=index;j<index+count;j++)
			{
				GListViewItem i=this[j];
				i.parent=null;
				i.gListView=null;
				if(this.GListView!=null)
					this.GListView.OnItemRemoved(new ItemEventArgs(i));
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -