المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : MDI Maximize,Minimize Problem.



C# Programming
04-15-2009, 01:11 AM
Hi
I have sample MDI application with two these forms :
Form1(Main Form) is MdiParent
Form2 is MdiChild

i want when Form2 open, it should be Maximize and user can't change it's WindowState, for this, i wrote this code to open Form2 :

Form2 frm;
frm.MdiParent = this;
frm.Show();

Form2 Designer Code :

this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 268);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false; // Set MaximizeBox to False
this.MinimizeBox = false; // Set MinimizeBox to False
this.Name = "Form2";
this.Text = "Form2";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ResumeLayout(false);

But, in runTime (as u see in above designer code which Maximize and Minimize set to False), when i open Form2, the Maximize and Minimize appear in Form2 and when click on Maximize button, it's WindowState change to normal (which i don't want this).
Where does my problem and how to solve it ?
Thanks