开发者

Changing Tabs in a Tab Control does not send Child a Message

开发者 https://www.devze.com 2023-01-31 17:04 出处:网络
In a C# Windows Forms application using Framework 2.X, clicking on a tab control does not send a message to the child controls (such as a lost focus event).Using Microsoft Spy++, I do not see messages

In a C# Windows Forms application using Framework 2.X, clicking on a tab control does not send a message to the child controls (such as a lost focus event). Using Microsoft Spy++, I do not see messages sent to my child control. I do get messages when I click back on the tab hosting the control.

Any ideas on what I need to开发者_如何学编程 do to have my child control know that its not displayed after the tab was changed. I would like the code to be in the control, not the parent. I am guessing that I am missing out on some event or registration.

Thanks in advance,

Craig


I am guessing that I am missing out on some event or registration.

I don't think you are.

The a lost focus event would be too soon since it happens before the page changes.

The Child Control's VisibleChanged event only fires when the parent TabPage is shown and not when it is hidden which is not what you want.

You can handle either the TabPage.VisibleChanged or the TabControl.SelectedIndexChanged. This of course is from the Parent not the Child, which is also not what you want.

Incidently I believe the TCM_SETCURSEL message is sent to the control on tab change (again not helping with the "not in the Parent requriement"

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号