开发者

Owner of a component. What exactly is this for?

开发者 https://www.devze.com 2022-12-26 11:59 出处:网络
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

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 ins开发者_JS百科ight would be appreciated.


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.

0

精彩评论

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