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

centering a childform in MDI parent

P: n/a
I have a simple c# app that opens a child form in a mdi parent.

I want the child form to open in the center of the mdi parent, so i
can open the child form ok, it all works fine, but setting

frmConfig = new ConfigForm(this);
frmConfig.MdiParent = this;
frmConfig.TopLevel = false;

frmConfig.StartPosition = FormStartPosition.CenterParent;
frmConfig.Show();
does not seem to work regardless if i set it runtime or in the windows
properties at design time.

The only way i can get CenterParent to work is to display the form
using Showdialog(), but then it has to be top level and the user can
drag it out the bounds of the MDI parent.
What i have found is if i use

frmConfig.StartPosition = FormStartPosition.CenterScreen;
this will display the childform in the center of the parent, seemingly
regardless of where the parent is located on screen.
All the internet examples ive found say to use
FormStartPosition.CenterParent;

Does anyone have any idea whats going on and how it should be done ?
Peted
Aug 23 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I will try it
if you can save your some time,pls help me solvet my problem:
===
how to know some fields were modified by user?
dear all,
how to know some fields were modified by user?
list bellow my project:
components: DataGridView,DataSet
when user change the DataGridView colmons field value,we can use
Dataset.Getchanges.tables[0] to list current record was modified.
but I can't know which fields were edited,only know the user edit the row.
even though I can't know it if a new record or edited record.
thanks all!!!
andy
2007-08-23

===
<Peted???????:kb********************************@4 ax.com...
>I have a simple c# app that opens a child form in a mdi parent.

I want the child form to open in the center of the mdi parent, so i
can open the child form ok, it all works fine, but setting

frmConfig = new ConfigForm(this);
frmConfig.MdiParent = this;
frmConfig.TopLevel = false;

frmConfig.StartPosition = FormStartPosition.CenterParent;
frmConfig.Show();
does not seem to work regardless if i set it runtime or in the windows
properties at design time.

The only way i can get CenterParent to work is to display the form
using Showdialog(), but then it has to be top level and the user can
drag it out the bounds of the MDI parent.
What i have found is if i use

frmConfig.StartPosition = FormStartPosition.CenterScreen;
this will display the childform in the center of the parent, seemingly
regardless of where the parent is located on screen.
All the internet examples ive found say to use
FormStartPosition.CenterParent;

Does anyone have any idea whats going on and how it should be done ?
Peted

Aug 23 '07 #2

P: n/a
Hi,
I also have faced same problem long back...
I am just giving you hint ... not a solution

Put frmConfig.StartPosition = FormStartPosition.CenterParent;
statement immidetely after frmConfig = new ConfigForm(this);

and put CenterParent in design time also.

Kishor


"Peted" wrote:
I have a simple c# app that opens a child form in a mdi parent.

I want the child form to open in the center of the mdi parent, so i
can open the child form ok, it all works fine, but setting

frmConfig = new ConfigForm(this);
frmConfig.MdiParent = this;
frmConfig.TopLevel = false;

frmConfig.StartPosition = FormStartPosition.CenterParent;
frmConfig.Show();
does not seem to work regardless if i set it runtime or in the windows
properties at design time.

The only way i can get CenterParent to work is to display the form
using Showdialog(), but then it has to be top level and the user can
drag it out the bounds of the MDI parent.
What i have found is if i use

frmConfig.StartPosition = FormStartPosition.CenterScreen;
this will display the childform in the center of the parent, seemingly
regardless of where the parent is located on screen.
All the internet examples ive found say to use
FormStartPosition.CenterParent;

Does anyone have any idea whats going on and how it should be done ?
Peted
Aug 23 '07 #3

P: n/a
Hey andy.....

There are many thirdparty components are available.... check for dirtybit
cheker.
Regards,
Kishor


"andy" wrote:
I will try it
if you can save your some time,pls help me solvet my problem:
===
how to know some fields were modified by user?
dear all,
how to know some fields were modified by user?
list bellow my project:
components: DataGridView,DataSet
when user change the DataGridView colmons field value,we can use
Dataset.Getchanges.tables[0] to list current record was modified.
but I can't know which fields were edited,only know the user edit the row.
even though I can't know it if a new record or edited record.
thanks all!!!
andy
2007-08-23

===
<Peted???????:kb********************************@4 ax.com...
I have a simple c# app that opens a child form in a mdi parent.

I want the child form to open in the center of the mdi parent, so i
can open the child form ok, it all works fine, but setting

frmConfig = new ConfigForm(this);
frmConfig.MdiParent = this;
frmConfig.TopLevel = false;

frmConfig.StartPosition = FormStartPosition.CenterParent;
frmConfig.Show();
does not seem to work regardless if i set it runtime or in the windows
properties at design time.

The only way i can get CenterParent to work is to display the form
using Showdialog(), but then it has to be top level and the user can
drag it out the bounds of the MDI parent.
What i have found is if i use

frmConfig.StartPosition = FormStartPosition.CenterScreen;
this will display the childform in the center of the parent, seemingly
regardless of where the parent is located on screen.
All the internet examples ive found say to use
FormStartPosition.CenterParent;

Does anyone have any idea whats going on and how it should be done ?
Peted


Aug 23 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.