简体   繁体   English

C#:WinForm容器焦点事件

[英]C#: WinForm Container Focus Event

I'm making a Windows Form as seen below. 我正在制作一个Windows窗体,如下所示。 When I click on a row in the DataGridView , the details of a person is transferred unto the TextBoxes at the side. 当我在DataGridView单击一行时,一个人的详细信息将转移到侧面的TextBoxes中。 When the user click the Edit button,the entire Panel to the right becomes editable; 当用户单击“ Edit按钮时, 右侧整个 Panel变为可编辑状态。 the TextBoxes and CheckBoxes are Enabled and allows the users to edit a person's name, birthday, etc. After which, the changes are saved to the database. EnabledTextBoxes和“ CheckBoxes ,并允许用户编辑一个人的姓名,生日等。此后,所做的更改将保存到数据库中。 在此处输入图片说明 I don't want the user to click a different row while editing and thus want to detect when a user leaves the Panel so I can prompt him/her. 我不希望用户在编辑时单击其他行,因此希望检测用户何时离开Panel以便我提示他/她。

How do I detect if I've lost focus of the Panel ? 如何确定我是否失去了Panel关注? If I'm going about this wrong, please respond with the appropriate answer instead. 如果我要解决此错误,请改以适当的答案进行回复。

也许当用户开始在Panel编辑记录时,可以将DataGridView的Enabled属性设置为False ,而当按下Save按钮时,可以再次将Enabled属性设置为True

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM