今天单位提出一个新的需求,需要使用拼音首字母检索Combox中的文字。 用了大概1小时时间准做出的这个控件和大家分享一下。 using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.Collections; namespace TSMCIS.Modules.ZYGL001.ICTCustomControl { /// <summary> /// 可以根据拼音首字母进行检索其中文字的Combox /// Roy`Lee2009-06-24 /// </summary> /// <remarks> /// /// </remarks> public class ucl_Combox : ComboBox { private ArrayList m_list = new ArrayList(); protected override void OnEnter(EventArgs e) { m_list.Clear(); m_list.AddRange(this.Items); base.OnEnter(e); } protected override void OnLeave(EventArgs e) { this.Items.Clear(); this.Items.AddRange(m_list.ToArray()); base.OnLeave(e); } protected override void OnTextUpdate(EventArgs e)