我有一个listbox控件和三个textbox表单
如果用户有焦点说txtbox1并且用户单击项目listbox,则应将所选项目文本设置为焦点textbox1。
但就我而言,每当我点击 中的项目时listbox,txtbox1根本不会保持焦点。
private void lstFields_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ListBoxControl ListBox = (ListBoxControl)sender;
int itemIndex = ListBox.IndexFromPoint(e.Location);
if (itemIndex == -1)
{
lstFields.SelectedIndex = -1;
return;
}
else
{
//Here I need that focused textbox to set value
}
}
}