EDN Admin
Well-known member
I am currently working on an MDI project and would like to have a specific child form to startup in the center of the MDI parent container.
In the Properties pane for this child form I have StartPosition set to CenterParent.
Then in the MDI Parent constructor I have:
<div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:courier new;background-color:white
<table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0>
<colgroup>
<col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:courier new;white-space:nowrap </colgroup>
<tbody>
<tr>
<td><font style="font-size:11px frmChild Child = </font><font color=blue>new</font><font style="font-size:11px frmChild();
Child.MdiParent = </font><font color=blue>this</font><font style="font-size:11px ;
Child.Show(); </font></td></tr></tbody></table>
This works to created an instance and show the form, but it will start in the upper left corner of the MDI Parent and not the center. I admit that Im new to C# and therefore a little rusty on some things, but if I set the StartPostion to CenterScreen and dont add the "Child.MdiParent = this;" section, then I get then it does center screen.
Any ideas why it is not centering to the parent?
<hr align=left width="25%" size=1>
When all else fails ---- grab the sledge hammer!
View the full article
In the Properties pane for this child form I have StartPosition set to CenterParent.
Then in the MDI Parent constructor I have:
<div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:courier new;background-color:white
<table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0>
<colgroup>
<col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:courier new;white-space:nowrap </colgroup>
<tbody>
<tr>
<td><font style="font-size:11px frmChild Child = </font><font color=blue>new</font><font style="font-size:11px frmChild();
Child.MdiParent = </font><font color=blue>this</font><font style="font-size:11px ;
Child.Show(); </font></td></tr></tbody></table>
This works to created an instance and show the form, but it will start in the upper left corner of the MDI Parent and not the center. I admit that Im new to C# and therefore a little rusty on some things, but if I set the StartPostion to CenterScreen and dont add the "Child.MdiParent = this;" section, then I get then it does center screen.
Any ideas why it is not centering to the parent?
<hr align=left width="25%" size=1>
When all else fails ---- grab the sledge hammer!
View the full article