移动表格 [英] Moving Forms

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

问题描述




我对VB.NET很新,我希望有人可以帮我解决什么是

可能是一个简单的问题。


我有一个MDI应用程序,当我打开一个子表单时,我希望它集中在

父级。所以我在FormLoad程序中添加了一些代码,这些代码可以在屏幕的中心运行,并且可以让孩子适当地移动。


这几乎就是代码我有:


MdiParent = frmMain

Me.Top =((frmMain.Height - Me.Height)/ 2)

Me.Left =((frmMain.Width - Me.Width)/ 2)

Refresh_VehicleList()


问题是当这个窗口打开时,你实际上可以看到

表单移动。似乎如果我删除对refresh_vehiclelist的调用

,问题不是很糟糕,但仍然可见。这个程序

使得SQL服务器调用因此在打开

连接时会暂时暂停。它不是硬件的速度问题,因为它是当前的

Core 2 Duo系统。


我的问题是,无论如何在移动之前隐藏表格它(我是
尝试了Hide方法,但它没有移动)所以用户每次打开它时都看不到

表格?


非常感谢提前!


布拉德。

Hi,

Im fairly new to VB.NET and am hoping someone can help me with what is
probably a simple problem.

I have an MDI app, when I open a child form, I want it centered to the
parent. So I put some code in the FormLoad procedure which works out
the centre of the screen and moves the child appropraitely.

This is pretty much the code I have:

MdiParent = frmMain
Me.Top = ((frmMain.Height - Me.Height) / 2)
Me.Left = ((frmMain.Width - Me.Width) / 2)
Refresh_VehicleList()

The problem is that when this window opens, you can actually see the
form move. It seems that if i remove the call to refresh_vehiclelist
that the problem isnt as bad, but is still visible. This procedure
makes SQL server calls so tends to pause briefly as it opens the
connection. Its not a speed issue with the hardware as its a current
Core 2 Duo system.

My question is, is there anyway to hide the form before moving it (I
tried the Hide method but it didnt move) so that the user can not see
the form moving every time they open it?

Many thanks in advance!

Brad.

推荐答案

只需将代码放在InitializeCompenent调用后的Sub New下。作为me.hide问题答案的

,你可以设置me.visible =

false。


谢谢,


Seth Rowe
bw ***** @ gmail.com 写道:
Just put the code under Sub New After the InitializeCompenent call. As
for the answer to the me.hide question, you can just set me.visible =
false.

Thanks,

Seth Rowe
bw*****@gmail.com wrote:




我是VB.NET的新手,我希望有人能帮助我是
可能是一个简单的问题。


我有一个MDI应用程序,当我打开一个子表单时,我希望它集中在

父母。所以我在FormLoad程序中添加了一些代码,这些代码可以在屏幕的中心运行,并且可以让孩子适当地移动。


这几乎就是代码我有:


MdiParent = frmMain

Me.Top =((frmMain.Height - Me.Height)/ 2)

Me.Left =((frmMain.Width - Me.Width)/ 2)

Refresh_VehicleList()


问题是当这个窗口打开时,你实际上可以看到

表单移动。似乎如果我删除对refresh_vehiclelist的调用

,问题不是很糟糕,但仍然可见。这个程序

使得SQL服务器调用因此在打开

连接时会暂时暂停。它不是硬件的速度问题,因为它是当前的

Core 2 Duo系统。


我的问题是,无论如何在移动之前隐藏表格它(我是
尝试了Hide方法,但它没有移动)所以用户每次打开它时都看不到

表格?


非常感谢提前!


布拉德。
Hi,

Im fairly new to VB.NET and am hoping someone can help me with what is
probably a simple problem.

I have an MDI app, when I open a child form, I want it centered to the
parent. So I put some code in the FormLoad procedure which works out
the centre of the screen and moves the child appropraitely.

This is pretty much the code I have:

MdiParent = frmMain
Me.Top = ((frmMain.Height - Me.Height) / 2)
Me.Left = ((frmMain.Width - Me.Width) / 2)
Refresh_VehicleList()

The problem is that when this window opens, you can actually see the
form move. It seems that if i remove the call to refresh_vehiclelist
that the problem isnt as bad, but is still visible. This procedure
makes SQL server calls so tends to pause briefly as it opens the
connection. Its not a speed issue with the hardware as its a current
Core 2 Duo system.

My question is, is there anyway to hide the form before moving it (I
tried the Hide method but it didnt move) so that the user can not see
the form moving every time they open it?

Many thanks in advance!

Brad.


在实际打开

表单之前使用StartPosition属性怎么样?这会有帮助吗?


Dim frm As New Form2


frm.StartPosition = FormStartPosition.CenterParent


frm.Visible = True

Steve


< bw ***** @ gmail.comwrote in message

新闻:11 ********************** @ c28g2000cwb.googlegr oups.com ...
What about using the StartPosition property before you actually open the
form? Will that help?

Dim frm As New Form2

frm.StartPosition = FormStartPosition.CenterParent

frm.Visible = True
Steve

<bw*****@gmail.comwrote in message
news:11**********************@c28g2000cwb.googlegr oups.com...
$ b $


我是VB.NET的新手,我希望有人可以帮我解决什么是

可能是一个简单的问题。


我有一个MDI应用程序,当我打开子表单时,我希望它集中在

父级。所以我在FormLoad程序中添加了一些代码,这些代码可以在屏幕的中心运行,并且可以让孩子适当地移动。


这几乎就是代码我有:


MdiParent = frmMain

Me.Top =((frmMain.Height - Me.Height)/ 2)

Me.Left =((frmMain.Width - Me.Width)/ 2)

Refresh_VehicleList()


问题是当这个窗口打开时,你实际上可以看到

表单移动。似乎如果我删除对refresh_vehiclelist的调用

,问题不是很糟糕,但仍然可见。这个程序

使得SQL服务器调用因此在打开

连接时会暂时暂停。它不是硬件的速度问题,因为它是当前的

Core 2 Duo系统。


我的问题是,无论如何在移动之前隐藏表格它(我是
尝试了Hide方法,但它没有移动)所以用户每次打开它时都看不到

表格?


非常感谢提前!


布拉德。
Hi,

Im fairly new to VB.NET and am hoping someone can help me with what is
probably a simple problem.

I have an MDI app, when I open a child form, I want it centered to the
parent. So I put some code in the FormLoad procedure which works out
the centre of the screen and moves the child appropraitely.

This is pretty much the code I have:

MdiParent = frmMain
Me.Top = ((frmMain.Height - Me.Height) / 2)
Me.Left = ((frmMain.Width - Me.Width) / 2)
Refresh_VehicleList()

The problem is that when this window opens, you can actually see the
form move. It seems that if i remove the call to refresh_vehiclelist
that the problem isnt as bad, but is still visible. This procedure
makes SQL server calls so tends to pause briefly as it opens the
connection. Its not a speed issue with the hardware as its a current
Core 2 Duo system.

My question is, is there anyway to hide the form before moving it (I
tried the Hide method but it didnt move) so that the user can not see
the form moving every time they open it?

Many thanks in advance!

Brad.



怎么样在实际打开

表单之前使用StartPosition属性?这会有帮助吗?


Dim frm As New Form2


frm.StartPosition = FormStartPosition.CenterParent


frm.Visible = True

Steve


< bw ***** @ gmail.comwrote in message

新闻:11 ********************** @ c28g2000cwb.googlegr oups.com ...
What about using the StartPosition property before you actually open the
form? Will that help?

Dim frm As New Form2

frm.StartPosition = FormStartPosition.CenterParent

frm.Visible = True
Steve

<bw*****@gmail.comwrote in message
news:11**********************@c28g2000cwb.googlegr oups.com...
$ b $


我是VB.NET的新手,我希望有人可以帮我解决什么是

可能是一个简单的问题。


我有一个MDI应用程序,当我打开子表单时,我希望它集中在

父级。所以我在FormLoad程序中添加了一些代码,这些代码可以在屏幕的中心运行,并且可以让孩子适当地移动。


这几乎就是代码我有:


MdiParent = frmMain

Me.Top =((frmMain.Height - Me.Height)/ 2)

Me.Left =((frmMain.Width - Me.Width)/ 2)

Refresh_VehicleList()


问题是当这个窗口打开时,你实际上可以看到

表单移动。似乎如果我删除对refresh_vehiclelist的调用

,问题不是很糟糕,但仍然可见。这个程序

使得SQL服务器调用因此在打开

连接时会暂时暂停。它不是硬件的速度问题,因为它是当前的

Core 2 Duo系统。


我的问题是,无论如何在移动之前隐藏表格它(我是
尝试了Hide方法,但它没有移动)所以用户每次打开它时都看不到

表格?


非常感谢提前!


布拉德。
Hi,

Im fairly new to VB.NET and am hoping someone can help me with what is
probably a simple problem.

I have an MDI app, when I open a child form, I want it centered to the
parent. So I put some code in the FormLoad procedure which works out
the centre of the screen and moves the child appropraitely.

This is pretty much the code I have:

MdiParent = frmMain
Me.Top = ((frmMain.Height - Me.Height) / 2)
Me.Left = ((frmMain.Width - Me.Width) / 2)
Refresh_VehicleList()

The problem is that when this window opens, you can actually see the
form move. It seems that if i remove the call to refresh_vehiclelist
that the problem isnt as bad, but is still visible. This procedure
makes SQL server calls so tends to pause briefly as it opens the
connection. Its not a speed issue with the hardware as its a current
Core 2 Duo system.

My question is, is there anyway to hide the form before moving it (I
tried the Hide method but it didnt move) so that the user can not see
the form moving every time they open it?

Many thanks in advance!

Brad.






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

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