473,698 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.MdiPa rent = this;
frmConfig.TopLe vel = false;

frmConfig.Start Position = FormStartPositi on.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.Start Position = FormStartPositi on.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
FormStartPositi on.CenterParent ;

Does anyone have any idea whats going on and how it should be done ?
Peted
Aug 23 '07 #1
3 4306
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,Da taSet
when user change the DataGridView colmons field value,we can use
Dataset.Getchan ges.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???????:k b************** *************** ***@4ax.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.MdiPa rent = this;
frmConfig.TopLe vel = false;

frmConfig.Start Position = FormStartPositi on.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.Start Position = FormStartPositi on.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
FormStartPositi on.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.Start Position = FormStartPositi on.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.MdiPa rent = this;
frmConfig.TopLe vel = false;

frmConfig.Start Position = FormStartPositi on.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.Start Position = FormStartPositi on.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
FormStartPositi on.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,Da taSet
when user change the DataGridView colmons field value,we can use
Dataset.Getchan ges.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???????:k b************** *************** ***@4ax.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.MdiPa rent = this;
frmConfig.TopLe vel = false;

frmConfig.Start Position = FormStartPositi on.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.Start Position = FormStartPositi on.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
FormStartPositi on.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
4631
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) body { text-align: center; min-width: 500px;
6
1600
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 " & Me.MdiChildren.Length.ToString ch.Show()
3
4733
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 ShowDialog method. I am having a similar problem and I found a thread that had the following code in the child form's Load event: Me.Location = New Point(( _ Me.MdiParent.ClientSize.Width - Me.Width) * 0.5,
0
1034
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 (StartPosition = CenterParent)
1
2709
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 screen too well if the resolution is smaller than 800x600 (why did it have to be my app?) Yes, I know, get a bigger screen - $$. Management is on it - just not right now. The parent form can be resized but not the child form. What is the way...
2
3058
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 and the number of them can vary greatly. They are all contained within a parent table cell, which is centred on the page. But I am unable to find a way of centering these table cells within the parent cell.
5
1585
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? Private Sub RxWaypoints_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles RxWaypoints.Click
0
6646
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 method inside another child form. The squence of events as follows : MDI Parent MDIMain loaded MDI Child Form1 loaded Form1 should load MDI Child Form2 and adds it to split container panel2 in MDIMain, finally display Form2 inside the MDIMain...
0
1225
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 labels will be covered by the childform. can i bring the childform to front, or is there any way to get the labels covered by the childform? Thank you.
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8902
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8873
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4623
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.