首先要设置TextBox的AutoCompleteMode为Suggest
AutoCompleteSource为CustomSource。
然后就写代码了:)
private void Form1_Load(object sender, EventArgs e)
{
AutoCompleteStringCollection collection = new AutoCompleteStringCollection();
textBox2.AutoCompleteCustomSource = collection;
collection.AddRange(new string[] { "a", "aaa", "aaaa", "aaaaa", "aaaaaa", "aaaaaaaaccc" });
}
设定新增行背景颜色
this.IDC_DGV_ITEMREGISTER.Rows[i].DefaultCellStyle.SelectionBackColor = Color.FromArgb(102, 153, 255);
设定某列内文字的对齐方式
this.IDC_DGV_USERAUTHORITY.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;