using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; public class AutoCompleteSimple : Form { [STAThread] static void Main() { Application.EnableVisualStyles(); Application.Run(new AutoCompleteSimple()); } public AutoCompleteSimple() { InitializeComponent(); string[] nomCouleurs; nomCouleurs = System.Enum.GetNames(typeof(KnownColor)); listCouleurs.Items.AddRange(nomCouleurs); } private System.Windows.Forms.ComboBox listCouleurs; private void InitializeComponent() { this.listCouleurs = new System.Windows.Forms.ComboBox(); this.SuspendLayout(); this.listCouleurs.AutoCompleteMode = ((System.Windows.Forms.AutoCompleteMode)((System.Windows.Forms.AutoCompleteMode.Suggest | System.Windows.Forms.AutoCompleteMode.Append))); this.listCouleurs.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.listCouleurs.FormattingEnabled = true; this.listCouleurs.Location = new System.Drawing.Point(13, 13); this.listCouleurs.Name = "listCouleurs"; this.listCouleurs.Size = new System.Drawing.Size(267, 21); this.listCouleurs.TabIndex = 0; this.AutoScaleBaseSize = new System.Drawing.Size(5, 14); this.ClientSize = new System.Drawing.Size(296, 82); this.Controls.Add(this.listCouleurs); this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Name = "AutoCompleteSimple"; this.Text = "AutoComplete Simple sur un ComboBox"; this.ResumeLayout(false); } } |
0