Textbox像百度一下实现下拉显示 z

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数据加载后的效果

时间: 2024-07-29 07:51:42

Textbox像百度一下实现下拉显示 z的相关文章

winform Textbox像百度一下实现下拉显示

1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 9 using System.Windows.Forms; 10 11 namespace _0

DataGridView单元格内容自动匹配下拉显示

页面显示数据使用的控件是ComponentFactory.Krypton.Toolkit中的KryptonDataGridView控件.在指定“商品”单元格中需要根据用户输入内容自动匹配数据库中商品信息,并且单元格处于编辑模式时显示一个查询图标的按钮,点击该按钮也将显示数据库中所有商品信息. KryptonDataGridView显示控件此处命名为kDGVIndentDetail; 用于下拉显示匹配内容的DataGridView命名为dgv; 1.建立一个DataGridView类型的页面变量用

java简单的实现搜索框的下拉显示相关搜索功能

最近做了一个简单的搜索框下面下拉显示相关搜索的功能,有点模仿百度的下拉展示相关搜索 先上个展示图 : 点击进入演示地址,大家可以输入长点的搜索,点击搜索,再输入之前搜索词的前面部分,看是否能展示出来 搜索框相关搜索的展示很简单,就是根据你的搜索词,去数据库中匹配,是否有类似的搜索词存在,按照搜索词被搜索的次数进行排序显示出来 我设计的是每次搜索一个词,提交之后都会去数据库进行查询,看是否存在这个搜索词的搜索,若存在,则对数据库中的这个搜索词对象进行次数加1,不存在,则创建这个新搜索词对象,保存在

input输入框下拉显示tree树

这次做项目还用到了另一个tree树的插件,就是input输入框下拉tree树 我这只是简单的下拉显示tree树,没有tree树的添加.编辑.删除.移动等操作 先看图片 zTree官方API文档 http://www.treejs.cn/v3/api.php 上代码 引入的js <script src="js/jquery-1.4.4.min.js" type="text/javascript"></script> <link href=

UIScrollView UITableView 上拉隐藏导航栏和tabbar 下拉显示导航栏和tabbar

//UIScrollView  UITableView 上拉隐藏导航栏和tabbar 下拉显示导航栏和tabbar-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{ CGPoint translation = [scrollView.panGestureRecognizer translationInView:scrollView.superview];    if

js禁止微信浏览器下拉显示黑底查看网址,不影响内部Scroll

开发项目跑在微信浏览器经常会遇到一个问题,微信浏览器下拉的时候会出现自带的黑色底色(显示网址)如下图: 网上好多js禁止操作的做法禁止了内部Scroll,导致页面不能滚动,上拉加载失效,例如这种做法: $('body').on('touchmove', function (event) {event.preventDefault();}); or document.addEventListener('touchmove', function(e){e.preventDefault()}, fal

JQuery 简单的文字超出部分隐藏下拉显示

HTML代码: <body> <div class="txt_bos"><!--在每一个放置文字的class外面包一个div,以便设置动画样式用,同样用class--> <div class="txt1"><!--为了保证功能的通用性,这里全用class--> 石村,位于苍莽山脉中,四周高峰大壑,茫茫群山巍峨. 清晨,朝霞灿灿,仿若碎金一般洒落,沐浴在人身上暖洋洋. 一群孩子,从四五岁到十几岁不等,能有数十

C# ComboBox 下拉显示层次(树)

数据库中很多时候用到树形结构,在界面上显示时如果是下拉框一次性显示时需要树结构来体现,看个效果图先: 主要是用算法补空格,补符号,源码如下: using System;using System.Collections;using System.Collections.Generic;using System.Linq;using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form

combobox后台查询,前端下拉显示

/** * 获得数据库数据 * */ @Action(value="sysList_data_list") public void getSysListDataList(){ List<Map<String,String>> list = new ArrayList<Map<String,String>>(); String hql = " from SysList a where 1=1 "; List<Sys