问:表格的父母 [英] Q: Parent of a form

查看:60
本文介绍了问:表格的父母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




假设我有两种形式:Form1和Form2。我在Form1的代码中创建并显示了一个

Form2的实例,例如


Dim myForm2 = New Form2

myForm2.Show ()


如何告诉myForm2 Form1是它的父级?也就是说,当我查看

时,父母或ParentForm或ParentForm。在Form2中,它们都显示Nothing。


任何人都可以帮忙???


提前致谢


Geoff

Hi

Suppose I have two forms: Form1 and Form2. I create and show an instance of
Form2 in the code of Form1 e.g.

Dim myForm2 = New Form2
myForm2.Show()

How do I tell myForm2 that Form1 is its parent? That is, when I look at
either "Parent" or "ParentForm" in Form2, they both show "Nothing".

Can anybody help???

Thanks in advance

Geoff

推荐答案

" Geoff Jones" < GE *** @ NODAMNSPAM.com> schrieb:
"Geoff Jones" <ge***@NODAMNSPAM.com> schrieb:
假设我有两种形式:Form1和Form2。我在Form1的代码中创建并显示了一个
Form2的实例,例如

Dim myForm2 = New Form2
myForm2.Show()

如何告诉myForm2 Form1是它的父级?也就是说,当我看到
要么是父母,要么是父母。或ParentForm或ParentForm。在Form2中,它们都显示Nothing。
Suppose I have two forms: Form1 and Form2. I create and show an instance
of
Form2 in the code of Form1 e.g.

Dim myForm2 = New Form2
myForm2.Show()

How do I tell myForm2 that Form1 is its parent? That is, when I look at
either "Parent" or "ParentForm" in Form2, they both show "Nothing".




您想以模态方式显示表单吗?


\ \\

Dim MyForm2 As New Form2()

MyForm2.ShowDialog()

///


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL:http://dotnet.mvps.org/dotnet/faqs/>



Do you want to show your form modally?

\\\
Dim MyForm2 As New Form2()
MyForm2.ShowDialog()
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


尝试使用.showdialog设置父母


" Geoff Jones" < GE *** @ NODAMNSPAM.com>在消息中写道

news:41 ********************* @ news.dial.pipex.com ..。
try using .showdialog to set the parent

"Geoff Jones" <ge***@NODAMNSPAM.com> wrote in message
news:41*********************@news.dial.pipex.com.. .


假设我有两种形式:Form1和Form2。我在Form1的代码中创建并显示Form2的实例
,例如

Dim myForm2 = New Form2
myForm2.Show()

如何做我告诉myForm2 Form1是它的父级吗?也就是说,当我看到
要么是父母,要么是父母。或ParentForm或ParentForm。在Form2中,它们都显示Nothing。

任何人都可以帮忙???

提前致谢

Geoff
Hi

Suppose I have two forms: Form1 and Form2. I create and show an instance of Form2 in the code of Form1 e.g.

Dim myForm2 = New Form2
myForm2.Show()

How do I tell myForm2 that Form1 is its parent? That is, when I look at
either "Parent" or "ParentForm" in Form2, they both show "Nothing".

Can anybody help???

Thanks in advance

Geoff



您好


感谢您的建议;虽然我不认为你的建议是

正是我需要的。


在Form2中,我有一个进度控件,我正在使用它在Form1中显示

计算进度。如果我正确理解ShowDialog,使用这个
,程序将在Form1中停止。我想我可以使用

线程,正如新闻组中的其他人所建议的那样,但是,我仍然认为必须有一种方法可以使用我拥有的技术来实现它描述即

在第一种形式中显示带有进度控件的表单,并从Form1中增加

控件,例如


theProgressControl.Increment(1)''在Form1中调用


这确实有效。但是,我希望第二种形式,即具有

进度控制的形式,以第一种形式为中心。我尝试过使用:


myForm2.StartPosition = FormStartPosition.CenterParent


但这不符合我的预期,即它不是'第一种形式为中心。


有人可以提供帮助吗?


Geoff


" ; Herfried K. Wagner [MVP]" <喜*************** @ gmx.at>在消息中写道

news:%2 **************** @ TK2MSFTNGP14.phx.gbl ...
Hi

Thanks for your advice; although I don''t think what you are suggesting is
exactly what I require.

In Form2, I have a progress control, which I am using to display the
progress of calculations in Form1. If I understand ShowDialog correctly,
using this, the program will stop within Form1. I suppose I could use
Threads, as others in the newsgroup have kindly suggested, however, I still
think there must be a way to do it using the technique I have described i.e.
show the form with the progress control in the first form, and increment the
control from within Form1 e.g.

theProgressControl.Increment(1) '' This is called within Form1

This does indeed work. However, I want the second form i.e. the one with the
progress control, to be centered in the first form. I''ve tried using:

myForm2.StartPosition = FormStartPosition.CenterParent

but this does not do what I expect i.e. it isn''t centered on the first form.

Can anybody help?

Geoff

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
"杰夫琼斯 < GE *** @ NODAMNSPAM.com> schrieb:
"Geoff Jones" <ge***@NODAMNSPAM.com> schrieb:
假设我有两种形式:Form1和Form2。我在Form1的代码中创建并显示了一个
Form2的实例,例如

Dim myForm2 = New Form2
myForm2.Show()

如何告诉myForm2 Form1是它的父级?也就是说,当我看到
要么是父母,要么是父母。或ParentForm或ParentForm。在Form2中,它们都显示Nothing。
Suppose I have two forms: Form1 and Form2. I create and show an instance
of
Form2 in the code of Form1 e.g.

Dim myForm2 = New Form2
myForm2.Show()

How do I tell myForm2 that Form1 is its parent? That is, when I look at
either "Parent" or "ParentForm" in Form2, they both show "Nothing".



您想以模态方式显示表单吗?

\\\
Dim MyForm2 As New Form2()
MyForm2.ShowDialog()
///

- MS Herfried K. Wagner
MVP< URL :http://dotnet.mvps.org/>
VB< URL:http://dotnet.mvps.org/dotnet/faqs/>



Do you want to show your form modally?

\\\
Dim MyForm2 As New Form2()
MyForm2.ShowDialog()
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



这篇关于问:表格的父母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆