0
我有一个winforms自定义用户界面控件库,其中包含一个显示模式对话框画中画的控件。松散地耦合模式对话框 - 这可能吗?
此自定义控件接收作为参数的指针,该指针指向启动其显示的控件。所以他们被绑在一起。这允许控制器模式地显示在启动它的窗口上。
Dim f As New PiPCustomDialog 'this form wraps another form PictureInPicture style
f.FormToLoad = New PrintOptions() 'this is the form the user will interact with
f.Owner = Me 'used to determine the size of PiPCustomDialog
Dim dr As DialogResult = f.ShowDialog(Me) 'shows PiPCustonDialog coating, f's OnLoad event initiates display of FormToLoad centered within.
这个控件需要f.Owner被设置的事实是什么臭。 User32.dll有一个函数GetActiveWindow(),这可能会让控件更加自给自足。
谁在那里谁想教这个老狗一个新的诡计?我想学习更好的方法。
我不明白。如果您只是删除f.Owner作业,它会更好吗?不需要,将我传给ShowDialog()也是一样。或者这实际上是一种控制而不是一种形式?什么是“f”? – 2010-01-06 18:00:50
好吧,你说的对不清楚。 f是自定义控件的一个实例。我会添加更多信息。 – bperreault 2010-01-06 19:05:45