471,334 Members | 1,427 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

simple form question

Hi

I'm learning c# 2.0 as I feel I need to be able to switch between vb & c#,
I'm just starting with a few simple examples and I've come across a problem.
I've got two forms ones an MDI parent & ones a child form.

I've put this code into a menustrip on the parent form
private void maintainClientsToolStripMenuItem_Click(object sender,
EventArgs e)
{
FrmCustomer frm = new FrmCustomer();
frm.MdiParent=this;
frm.Show();
}

when I run the application, the child form seems to be shown in the left
hand upper corner (with the top bar of the form hidden behind the parents)
even though the child form is set to be maxmized, if I click the maximize
button in the child form it resizes to a small form and maximizing it gives
the right result and all works ok.

Why doesn't this work first time in vs2005, yet the same code does in vs2003?

--
Duncan
Feb 1 '06 #1
4 1664
Simple answer:
On the child form in the design time, set the StartPosition property to what
ever
you want. Eg WindowsDefaultLocation, Manual, CenterScreen,
WindowsDefaultBound, or >> CenterParent <<

"Duncan" wrote:
Hi

I'm learning c# 2.0 as I feel I need to be able to switch between vb & c#,
I'm just starting with a few simple examples and I've come across a problem.
I've got two forms ones an MDI parent & ones a child form.

I've put this code into a menustrip on the parent form
private void maintainClientsToolStripMenuItem_Click(object sender,
EventArgs e)
{
FrmCustomer frm = new FrmCustomer();
frm.MdiParent=this;
frm.Show();
}

when I run the application, the child form seems to be shown in the left
hand upper corner (with the top bar of the form hidden behind the parents)
even though the child form is set to be maxmized, if I click the maximize
button in the child form it resizes to a small form and maximizing it gives
the right result and all works ok.

Why doesn't this work first time in vs2005, yet the same code does in vs2003?

--
Duncan

Feb 2 '06 #2
Hi MadHatter

Thanks for the reply, but none of those options make any difference, the
form does not open as maximized the first time. there seems to be some
difference in the way VS2K5 works when displaying a child form compared to
VS2K3. if you haven't tried it I suggest trying my example. I have spoken to
a collegue of mine and have got them to create a sample and it doesn't work
as expected for them either (in c# or vb), though MSDN says this is how it
should work, but clearly it doesn't.

more investigation required on this to find out whats going on (I'm sure its
not a bug (well I'd be very surprised if it was))
--
Duncan
"TheMadHatter" wrote:
Simple answer:
On the child form in the design time, set the StartPosition property to what
ever
you want. Eg WindowsDefaultLocation, Manual, CenterScreen,
WindowsDefaultBound, or >> CenterParent <<

"Duncan" wrote:
Hi

I'm learning c# 2.0 as I feel I need to be able to switch between vb & c#,
I'm just starting with a few simple examples and I've come across a problem.
I've got two forms ones an MDI parent & ones a child form.

I've put this code into a menustrip on the parent form
private void maintainClientsToolStripMenuItem_Click(object sender,
EventArgs e)
{
FrmCustomer frm = new FrmCustomer();
frm.MdiParent=this;
frm.Show();
}

when I run the application, the child form seems to be shown in the left
hand upper corner (with the top bar of the form hidden behind the parents)
even though the child form is set to be maxmized, if I click the maximize
button in the child form it resizes to a small form and maximizing it gives
the right result and all works ok.

Why doesn't this work first time in vs2005, yet the same code does in vs2003?

--
Duncan

Feb 4 '06 #3
Yello, sorry I didnt write back sooner. I had enough time
to read your responce, and test a simple app, then I had
a 24h power blackout. (stupid falling trees!!!)

Okay I just finished testing your probem, and I cant
give you a reason why it doesnt try to maximize. Perhaps
the show() method doesnt try to resize the app?

I got around this by leaving the child form's property "WindowState"
to "normal", then after I have called the myform.Show() method, I
set the form's property "WindowState" to "Maximized". This did the
trick. I cant remember how exactly it worked in 03, but that is for
another person to figure out.

Conclusion:
This may or may not be a bug, but it is easy enough to programmaticly
tell the child form to maximize, that it probably isnt worth complaining
about.
"Duncan" wrote:
Hi MadHatter

Thanks for the reply, but none of those options make any difference, the
form does not open as maximized the first time. there seems to be some
difference in the way VS2K5 works when displaying a child form compared to
VS2K3. if you haven't tried it I suggest trying my example. I have spoken to
a collegue of mine and have got them to create a sample and it doesn't work
as expected for them either (in c# or vb), though MSDN says this is how it
should work, but clearly it doesn't.

more investigation required on this to find out whats going on (I'm sure its
not a bug (well I'd be very surprised if it was))
--
Duncan
"TheMadHatter" wrote:
Simple answer:
On the child form in the design time, set the StartPosition property to what
ever
you want. Eg WindowsDefaultLocation, Manual, CenterScreen,
WindowsDefaultBound, or >> CenterParent <<

"Duncan" wrote:
Hi

I'm learning c# 2.0 as I feel I need to be able to switch between vb & c#,
I'm just starting with a few simple examples and I've come across a problem.
I've got two forms ones an MDI parent & ones a child form.

I've put this code into a menustrip on the parent form
private void maintainClientsToolStripMenuItem_Click(object sender,
EventArgs e)
{
FrmCustomer frm = new FrmCustomer();
frm.MdiParent=this;
frm.Show();
}

when I run the application, the child form seems to be shown in the left
hand upper corner (with the top bar of the form hidden behind the parents)
even though the child form is set to be maxmized, if I click the maximize
button in the child form it resizes to a small form and maximizing it gives
the right result and all works ok.

Why doesn't this work first time in vs2005, yet the same code does in vs2003?

--
Duncan

Feb 6 '06 #4
Hi

Well They way it worked in vs2k3 was exactly that way, I might still report
even though it might not be a bug. Thanks for your help on this, I'll try
your work around.

Duncan

--
Duncan
"TheMadHatter" wrote:
Yello, sorry I didnt write back sooner. I had enough time
to read your responce, and test a simple app, then I had
a 24h power blackout. (stupid falling trees!!!)

Okay I just finished testing your probem, and I cant
give you a reason why it doesnt try to maximize. Perhaps
the show() method doesnt try to resize the app?

I got around this by leaving the child form's property "WindowState"
to "normal", then after I have called the myform.Show() method, I
set the form's property "WindowState" to "Maximized". This did the
trick. I cant remember how exactly it worked in 03, but that is for
another person to figure out.

Conclusion:
This may or may not be a bug, but it is easy enough to programmaticly
tell the child form to maximize, that it probably isnt worth complaining
about.
"Duncan" wrote:
Hi MadHatter

Thanks for the reply, but none of those options make any difference, the
form does not open as maximized the first time. there seems to be some
difference in the way VS2K5 works when displaying a child form compared to
VS2K3. if you haven't tried it I suggest trying my example. I have spoken to
a collegue of mine and have got them to create a sample and it doesn't work
as expected for them either (in c# or vb), though MSDN says this is how it
should work, but clearly it doesn't.

more investigation required on this to find out whats going on (I'm sure its
not a bug (well I'd be very surprised if it was))
--
Duncan
"TheMadHatter" wrote:
Simple answer:
On the child form in the design time, set the StartPosition property to what
ever
you want. Eg WindowsDefaultLocation, Manual, CenterScreen,
WindowsDefaultBound, or >> CenterParent <<

"Duncan" wrote:

> Hi
>
> I'm learning c# 2.0 as I feel I need to be able to switch between vb & c#,
> I'm just starting with a few simple examples and I've come across a problem.
> I've got two forms ones an MDI parent & ones a child form.
>
> I've put this code into a menustrip on the parent form
> private void maintainClientsToolStripMenuItem_Click(object sender,
> EventArgs e)
> {
> FrmCustomer frm = new FrmCustomer();
> frm.MdiParent=this;
> frm.Show();
> }
>
> when I run the application, the child form seems to be shown in the left
> hand upper corner (with the top bar of the form hidden behind the parents)
> even though the child form is set to be maxmized, if I click the maximize
> button in the child form it resizes to a small form and maximizing it gives
> the right result and all works ok.
>
> Why doesn't this work first time in vs2005, yet the same code does in vs2003?
>
> --
> Duncan

Feb 7 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Oli | last post: by
7 posts views Thread by r0adhog | last post: by
13 posts views Thread by LRW | last post: by
reply views Thread by 42 | last post: by
1 post views Thread by adam | last post: by
reply views Thread by rosydwin | last post: by

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.