控件得到焦点后会自动失去.

XueBoy163 2006-01-04 10:26:01
comboBox = new ComboBox();
foreach(IComponent cmp in Context.Container.Components )
{
comboBox.Items.Add(cmp.Site.Name);
}
Rectangle rect = columnList.SelectedItems[0].Bounds;
rect.X = rect.X + columnList.Columns[0].Width;
rect.Y = rect.Y -5;
rect.Height = rect.Height + 5;
rect.Width = columnList.Columns[1].Width + columnList.Columns[2].Width;
comboBox.Text = m_data[tableList.Text][m_preSelected].CombinationString;
comboBox.Bounds = rect;
comboBox.MouseHover +=new EventHandler(comboBox_MouseHover);
comboBox.Parent = columnList;
comboBox.LostFocus +=new EventHandler(comboBox_LostFocus);
comboBox.SelectedValueChanged +=new EventHandler(comboBox_SelectedValueChanged);
comboBox.Show();
comboBox.Focus();
这段代码执行完自动调用comboBox_LostFocus的代码.但在有的机器上却不会,很奇怪.请问是什么原因.
...全文
105 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
XueBoy163 2006-02-23
  • 打赏
  • 举报
回复
找到了,升级.netSP1后没有了
richrobey 2006-01-04
  • 打赏
  • 举报
回复
When you change the focus by using the mouse or by calling the Focus method, focus events occur in the following order:

Enter

GotFocus

LostFocus

Leave

Validating

Validated

既然有的机器上不行有的机器上行,看看是不是你移开焦点时的操作是不是有问题.

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧