MDIChild Size Troubles, it maximizes without order.

teixeira

Regular
Joined
Apr 5, 2005
Messages
94
Location
LEIRIA-PORTUGAL
Hi all,

I've a problem with a MDI Environment application and maximize functionality.
I set my main form as IsMDIContainer = true, but my MDIChild forms don't stay as i wish.
Everitime i load a form it resizes itself and stays maximized, unexpectedly.
Any suggestion to stop this?

PS:I tried already some suggestions i saw here in other posts, but doesn't worked

Thanks in advance
Tiago Teixeira
 
Is your WindowState property of your child forms set to Maximized?

If that is not the problem, post some code to show how you are adding your child forms.
 
Hi,

I wish it was that the problem, but i'm seriously thinking that could be an VS2005 bug when dealing with a lot of forms perhaps.
Well i have my main form as MDIContainer to start as Maximixed, and i have several mdi childs, that are basicly like these, in properties:

// FrmLogin
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(330, 197);
this.Controls.Add(this.label3);
this.Controls.Add(this.picBoxBannerLogin);
this.Controls.Add(this.btnLogin);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.cmbUsernames);
this.Controls.Add(this.txtBoxPassword);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(336, 229);
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(336, 229);
this.Name = "FrmLogin";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "LOGIN";
((System.ComponentModel.ISupportInitialize)(this.picBoxBannerLogin)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();

and i have a form that loads after the the Main loads, and it loads maximized as i want, but the other formas as this in example (Login,ChangePassword,etc) should open not maximized, and the properties e set are ok, i think.

TIA
Tiago Teixeira
 
Are you doing something similar to the following when creating the child forms?

Dim frm As FrmLogin = New FrmLogin
frm.MdiParent = Me ' Me, in this case, refers to MDI Parent form
frm.Show()
 
Sorry about the VB, I just noticed you were using C#.

Anyway, the default values of the Windows Form should make it appear like you want. So, if you are adding the child forms like above, then there has to be something else that is causing them to maximize.

I would try adding a standard, empty, default form as a child. See if it appears normally.
 
Try adding a blank form, in other words

Form frm = new Form();
frm.MDIParent = this;
frm.Show();

That will tell you if the problem is with your FrmLogin class or if the problem is something else.

If that blank form displays correctly, the problem is with the FrmLogin class. If it displays incorrectly, the problem is something else.
 
Back
Top