StartPosition.CenterParent

  • Thread starter C-Sharper or C-Hasher, one of the two
  • Start date
C

C-Sharper or C-Hasher, one of the two

Hi Guys and Gals,

I have a small, two form, application. Form1 is the main window and Form2 is
a small window that has a label and a progress bar on it. I wish to display
form2 whilst doing some processing in Form1 and update Form2 as the
processing is being completed. I have the update functionality working
properly, what I can't seem to get working is the functionality of being
able to position Form2 in the centre of Form1. I have set the StartPosition
property to CenterParent, but I can't seem to find a property where I can
set the parent property of Form2. Forms do have a Parent property,
unfortunately it's read only. I can get the form to behave, more or less,
correctly if I use ShowDialog instead of Show but that holds up processing
whilst the form waits to receive input it can pass back to the main form,
which of course is not ever going to come, as the form has no inputs of any
kind. The application is not an MDI application so I can't use the MDIParent
property.

I would also like to stop the form from being moved. Anyone know what
property or properties need to be set to make this happen? And I'd like to
turn off it's titlebar if possible.

Thanks

Regards

Greg
 
T

Tom Wells

Use MyForm.ShowDialog(this) instead of MyForm.Show()

this becomes the parent.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top