473,405 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

centering a childform in MDI parent

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
3 4285
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: CMAR | last post by:
To center my <div>, I am currently using something like <div id="navcontainer" align="center"> This centers fine, but is deprecated code. I have seen these two solutions recommended. 1) ...
6
by: andreas | last post by:
I can open several childforms with the following sub in de mdi form after clicking a button Private Sub NewWindow() Dim ch As New ChildForm() ch.MdiParent = Me ch.Text = "Textwindow nr " &...
3
by: Zack Sessions | last post by:
I am using VB.NET 2003. I have read the threads concerning the problem where the FormStartPosition of CenterParent is ignored if the form is displayed with the Show method as opposed to the...
0
by: mabond | last post by:
Hi I'm having a problem centering my child window within its parent. It is opening docked top left. Form properties as follows: frmMain (IsMdiContainer = true) frmPCASelection...
1
by: Rich | last post by:
Hello, I have a child form in a parent MDI form. The childform is being shrunk and cannot be resized when screen resolution is 800x600. The end user who uses my app cannot see stuff on the...
2
by: rudicheow | last post by:
SHORT VERSION ============= I have a bunch of identical fixed-size single-celled tables that rest against each other horizontally thanks to "float:left". These tables are dynamically generated...
5
by: Bruce | last post by:
I have the StartPosition property set to CenterParent for GarXfaceUI.TransferStatus. The button below is on another form. Why isn't GarXfaceUI.TransferStatus being centered in the parent? ...
0
by: syntax | last post by:
Hi, I am quite new to C# .NET, trying to understand the MDI Parent / Child form relations.. currently have an issue with regards to adding a child form to a mdi parent split container panel via...
0
by: thesti | last post by:
hello, i have some labels in my MDIParent form, they are greeting labels for the logged in user. when i open a childform, the labels cover the opened childform, while actually i expect that the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.