By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,573 Members | 1,806 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,573 IT Pros & Developers. It's quick & easy.

Centering Dialog Form on Parent

P: n/a
I have a primary form named frmMain. During some extended data pulls
I launch another Dialog Form named frmUpdating. [A little progress
meter shows up and scrolls across the screen why the data is being
pulled.] How do I keep the frmUpdating centered on the frmMain if a
user moves the frmMain form?

-Peter
Nov 21 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
How is anyone going to be able to move frmMain if frmUpdating (your dialog
form) is being show modally? Or am I missing something ?

Imran.

"Peter" <pe***@mclinn.com> wrote in message
news:dc**************************@posting.google.c om...
I have a primary form named frmMain. During some extended data pulls
I launch another Dialog Form named frmUpdating. [A little progress
meter shows up and scrolls across the screen why the data is being
pulled.] How do I keep the frmUpdating centered on the frmMain if a
user moves the frmMain form?

-Peter

Nov 21 '05 #2

P: n/a
Set StartPosition property of the form.

"Peter" wrote:
I have a primary form named frmMain. During some extended data pulls
I launch another Dialog Form named frmUpdating. [A little progress
meter shows up and scrolls across the screen why the data is being
pulled.] How do I keep the frmUpdating centered on the frmMain if a
user moves the frmMain form?

-Peter

Nov 21 '05 #3

P: n/a
Peter,
As Imran asks, is the UpdatingForm (frmUpdating) displayed with Form.Show or
Form.ShowDialog?

If you are using Form.Show, then you should be able to handle the Form.Move
& Form.Resize to manually move & resize your UpdatingForm.

If you are using Form.ShowDialog, then as Imran states, the user cannot move
your MainForm (frmMain).

FWIW: A "Dialog Form" implies to me that you are using Form.ShowDialog.

Hope this helps
Jay
"Peter" <pe***@mclinn.com> wrote in message
news:dc**************************@posting.google.c om...
I have a primary form named frmMain. During some extended data pulls
I launch another Dialog Form named frmUpdating. [A little progress
meter shows up and scrolls across the screen why the data is being
pulled.] How do I keep the frmUpdating centered on the frmMain if a
user moves the frmMain form?

-Peter

Nov 21 '05 #4

P: n/a
"Peter" <pe***@mclinn.com> schrieb:
I have a primary form named frmMain. During some extended
data pulls I launch another Dialog Form named frmUpdating.
[A little progress meter shows up and scrolls across the
screen why the data is being pulled.] How do I keep the
frmUpdating centered on the frmMain if a user moves the
frmMain form?


Are you showing the dialog form modally? Then the user will not be able to
move the main form at all. Otherwise add a handler to the main form's
'Move' event and place the code for positioning the dialog there.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #5

P: n/a
Peter,

Sorry, however in my opinion makes what you ask not so much sense.

I think that it is easier to use instead of a dialog form a panel what
starts invisible and when you need it make it visible. That panel has of
course to lay on top of the other controls.

Using the Dock property of the panel and setting that to dockstyle.fill
makes this even very easy.

The user does really not see it if you use a panel or a form.

I hope this gives an idea? (it really moves in the center of your form)

And when I see something wrong don't hesitate to reply.

Cor

"Peter" <
I have a primary form named frmMain. During some extended data pulls
I launch another Dialog Form named frmUpdating. [A little progress
meter shows up and scrolls across the screen why the data is being
pulled.] How do I keep the frmUpdating centered on the frmMain if a
user moves the frmMain form?

-Peter

Nov 21 '05 #6

P: n/a
I've added for frmUpdating in the designer and then call on the
frmUpdating.showDialog using a new thread:

IE.

This is in the frmMain:
Shared Sub RunUpdate(ByVal stateinfo As Object)
Dim frm_Update As New frmUpdating
frm_Update.ShowDialog()

End Sub

Then when I want my updaing to launch I do this:

ThreadPool.QueueUserWorkItem(AddressOf RunUpdate) 'Opens up the
frmUpdating

that runs until a global named StopNow = False 'I place this code
after my main proceedures run.

So basically the updating bar is more to just let the user know that
the data process is still running. The problem though is that because
these two forms are running on different threads that if a user moves
the form then the updating display is off center.

-Peter
Nov 21 '05 #7

P: n/a
Peter,

Because of all the other answers which are given in this thread, what is the
sense of a showdialogform with a multithreading operation. Your main
operation is freezen anyway.

Not everybody agrees this with me, however in my opinion when the user
cannot do anything in between and has to wait on the result of the
operation, than just let an avi or a animated gif go in your application in
the same way as microsoft does that.

The multithreading will only give you overhead.

Some of those AVI's you can find in
C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Graphics\videos

They are not supported for nothing.

However just my idea

Cor
"Peter" <pe***@mclinn.com>
I've added for frmUpdating in the designer and then call on the
frmUpdating.showDialog using a new thread:

IE.

This is in the frmMain:
Shared Sub RunUpdate(ByVal stateinfo As Object)
Dim frm_Update As New frmUpdating
frm_Update.ShowDialog()

End Sub

Then when I want my updaing to launch I do this:

ThreadPool.QueueUserWorkItem(AddressOf RunUpdate) 'Opens up the
frmUpdating

that runs until a global named StopNow = False 'I place this code
after my main proceedures run.

So basically the updating bar is more to just let the user know that
the data process is still running. The problem though is that because
these two forms are running on different threads that if a user moves
the form then the updating display is off center.

-Peter

Nov 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.