我有一个Windows应用程序,它加载了几个组件,包括一个PropertyGrid。
如果我在PropertyGrid中进行任何编辑并在PropertyGrid中的其他位置单击,焦点就会丢失,属性也会更新。
但是,当我在PropertyGrid中进行编辑并单击PropertyGrid以外的其他地方时,编辑光标显示在TextBox of PropertyGrid中,并且焦点没有丢失。在其他地方单击时,是否有可能强制失去焦点?
发布于 2015-09-14 18:40:22
您可以将窗体的活动控件设置为空。
private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
{
if (!this.propertyGrid1.RectangleToScreen(this.DisplayRectangle).Contains(Control.MousePosition))
{
if (this.ActiveControl == this.propertyGrid1) { this.ActiveControl = null; }
}
}https://stackoverflow.com/questions/32561305
复制相似问题