WinForm文本框設置自動提示

           // Create the list to use as the custom source. 
            var source = new AutoCompleteStringCollection();
            source.AddRange(new string[]
                    {
                        "李超",
                        "賀旭",
                        "郭暉",
                        "路遠"
                    });


            // Create and initialize the text box.
            var textBox = new TextBox
            {
                AutoCompleteCustomSource = source,
                AutoCompleteMode =
                    AutoCompleteMode.SuggestAppend,
                AutoCompleteSource =
                    AutoCompleteSource.CustomSource,
                Location = new Point(20, 20),
                Width = ClientRectangle.Width - 40,
                Visible = true
            };


            // Add the text box to the form.
            Controls.Add(textBox);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章