0
다음은 DGV 텍스트 상자 셀을 자동 완성 텍스트 상자로 만들 때 사용하는 코드입니다. 왜 datagridview 자동 완성 텍스트 상자 배경색이 검게 나타 납니까?
private void dgvEntryVerify_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
TextBox txtBox = e.Control as TextBox;
txtBox.CharacterCasing = CharacterCasing.Normal;
DataGridViewCell currentCell = dgvEntryVerify.CurrentCell;
List<string> tmpList = new List<string>();
string tmpValue = "";
try
{
if (e.Control is TextBox)
{
tmpValue = "";
tmpList.Clear();
TextBox currentTextBox = e.Control as TextBox;
currentTextBox.Multiline = false;
currentTextBox.AutoCompleteMode = AutoCompleteMode.Suggest;
currentTextBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
currentTextBox.AutoCompleteCustomSource = new AutoCompleteStringCollection();
if (currentCell.OwningColumn.Name.Contains("Parish"))
{
tmpValue = "";
tmpList.Clear();
tmpValue = currentCell.EditedFormattedValue.ToString();
tmpList = GlobalSettings.LookupParish.FindAll(t => t.StartsWith(tmpValue));
if (tmpList.Count > 0)
{
currentTextBox.AutoCompleteCustomSource.AddRange(tmpList.ToArray());
}
}
}
}
catch
{ }
}
그러나 UI의
은 자동 완성 텍스트 상자 내가 목록에서 선택한 동일한 값을 볼 수 있도록 나는 흰색 할 필요가 검은 색이된다.이 문제에 대한 해결책은 높이 평가됩니다.
VS2012, C# Winforms를 사용하고 있습니다.
블랙 셀은 일상의 코드 하나 개의 특정 라인에 의해 발생