Click here to Skip to main content
15,892,697 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
C#
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.comboBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.comboBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
            
this.comboBox1.DataSource = this.driverdetailBindingSource;
this.comboBox1.DisplayMember = "name";
this.comboBox1.Font = new System.Drawing.Font("Gujrati Saral-4", 12.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(86, 33);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 25);
this.comboBox1.TabIndex = 1;
this.comboBox1.ValueMember = "d_id";
Posted
Updated 21-Dec-13 22:29pm
v2
Comments
Member 10481416 22-Dec-13 2:56am    
i was change combobox1.font but its not work in suggestion list

1 solution

Unfortunately the font-face and size of the auto-complete text presented in the edited drop-down as you type-and-match is hard-wired.

I've seen two strategies for changing the auto-complete text:

1. handle auto-completion in code, and change the ComboBox SelectedIndex as you type.

There's an old example of that here on CodeProject: [^].

Another example, virtually identical code (copied from CP ?), from 2012: [^]

What you lose with this approach ... even if you modify the code to show the DropDown ... is seeing in the DropDown only the items that are potential matches. And, if you do modify the code to show the DropDown, you may find your mouse-behavior kind-of strange, since ... I hypothesize ... the DropDown "captures" the mouse.

2. create a custom control that shows a ListBox instead of the default DropDown: lots of work, that. You can find some examples on StackOverFlow, like: [^].

Conclusion: I suggest you avoid trying to do this unless absolutely necessary.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900