winform让Textbox像百度一下实现下拉显示
List<string> Data = new List<string>();
string Randomstr = "功夫撒黑胡椒hcbvf蜂窝qwertyuiopasdfghjklzxcvbnm法国的恢复到飞范德萨QWERTYUIOPASDFGHJKLZXCVBNM出现过热423贴①46546也有一头热刚恢复到贴3天赋如头3广泛的我让他";
Random rd = new Random(GetRandomSeed());
static int GetRandomSeed()
{
byte[] bytes = new byte[4];
System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider();
rng.GetBytes(bytes);
return BitConverter.ToInt32(bytes, 0);
}
public Form1()
{
InitializeComponent();
for (int i = 0; i < 20000000; i++)
{
Data.Add(Randomstr.ToCharArray()[rd.Next(Randomstr.Length)].ToString()
+ Randomstr.ToCharArray()[rd.Next(Randomstr.Length)].ToString()
+ Randomstr.ToCharArray()[rd.Next(Randomstr.Length)].ToString()
+ Randomstr.ToCharArray()[rd.Next(Randomstr.Length)].ToString()
+ Randomstr.ToCharArray()[rd.Next(Randomstr.Length)].ToString());
}
this.textBox1.AutoCompleteCustomSource.Clear();
this.textBox1.AutoCompleteCustomSource.AddRange(Data.ToArray());
this.textBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.textBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
}
下面是2000W数据加载后的效果

效果还可以。就分享了
...全文
相关推荐
新百度翻译 API调用程序
百度翻译旧服务已下线,迁移至 http://api.fanyi.baidu.com,本程序重新修改后,可以调用百度翻译的新的API。当然需要你自己申请APPID和密钥,然后就拥有属于你自己的翻译机了!
c# winform TextBox智能提示
用c# winform 实现类似百度和谷歌的智能提示!
winForm 文本框检索功能
模仿baidu搜索框,winform组件
winform文本框实现百度效果以及搜索记忆功能
这个winform的搜索记忆功能以及百度效果的搜索功能
TextBox 类似智能提示(C# WinForm)
实现类似google搜索和baidu 输入框效果,文本框输入智能提示 内容使用单独的Txt文件保存,重启程序仍旧保存上一次的数据 封装在单独的组件,本人测试已经通过


