组件的所有者。这究竟是为了什么?
我正在为 Windows Mobile 6 开发一个应用程序,并且有一个 CameraCaptureDialog 类,使我能够从我自己的应用程序调用相机应用程序。该类有一个 Owner 属性,互联网上的大多数示例都设置为“this”。
cam.Owner = 这个;
这到底是做什么的?我通过设置父控件看到了 Windows 窗体组件/控件的类似情况。在这种情况下,我猜它仅用于布局算法,但除此之外,还有什么有用的目的吗?
我不明白设置 CameraCaptureDialog 的所有者如何(并且实际上确实)产生任何影响。
任何见解将不胜感激。
I am developing an app for Windows Mobile 6 and there is a CameraCaptureDialog class that enables me to call a camera app from my own application. The class has an Owner property that most examples on the internet set to "this".
cam.Owner = this;
What exactly does this do? I've seen a similar scenario with Windows Forms components/controls by setting the Parent control. In that case I guess it's used only for layout algorithms, but other than that, is there any useful purpose?
I don't see how setting an owner of the CameraCaptureDialog can (and actually does) make any difference.
Any insight would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该对话框是模态对话框,它需要知道它的所有者是谁,以便如果显示所有者,则模态对话框位于其上方。如果您将其设置为“this”,那么它就会在您的表单上出现。如果您转到另一个应用程序,它将隐藏,但如果您带回您的应用程序,则将显示“此”表单,并且模式对话框将显示在其上方。
The dialog is modal, and it needs to know who it's owner is so that if the owner is shown, the modal dialog lies above it. If you set it to "this" then it's modal over your Form. If you go to another app it will hide, but if you bring your app back, the "this" Form will get displayed and the modal dialog will show over it.