simple form question

G

Guest

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?
 
G

Guest

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 <<
 
G

Guest

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))
 
G

Guest

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top