I want to disable MaximizeBox when child form WindowState is Maximized

Answered I want to disable MaximizeBox when child form WindowState is Maximized

  • Tuesday, May 08, 2012 2:31 PM
     
     

    I want to disable/remove MaximizeBox when child form WindowState is Maximized to the MdiParent form.

    I am marked MaximizeBox which i want to disable/remove.

    I wrote this code on Menu toolstrip button to open childe form on Parents form 

    Form2 f2=new Form2();

    f2.MdiParent=this;

    f2.MaximizeBox=false;

    f2.Show();

    Which code i have to write to disable/remove MaximizeBox which i marked on above image.


All Replies

  • Wednesday, May 09, 2012 1:54 AM
     
      Has Code

    this code add :

    f2.Dock = DockStyle.Fill;

  • Wednesday, May 09, 2012 5:07 AM
     
     

    I put this code like this n Form2 maximizeBox is False on Properties windows

    Form2 f2 = new Form2();
    f2.MdiParent = this;
    f2.Dock = DockStyle.Fill;
    f2.Show();

    then form open like this

    when i write code like this

    Form2 f2 = new Form2();
    f2.Dock = DockStyle.Fill;
    f2.MdiParent = this;
    f2.Show();

    then form open like this

    but nothing happen, i want to disable maximizeBox button of chind class so how can i do that ?

    I m uploading my project please download it make changes n return me with my solution.
    http://dl.dropbox.com/u/6608612/MDI%20container.rar 


  • Wednesday, May 09, 2012 7:39 AM
    Moderator
     
     

    Hi Akshay Lakhmani,

      Could you compress your application within zip file format because our computer couldn't install winrar application.

      Sincerely,

      Jason Wang


    Jason Wang [MSFT]
    MSDN Community Support | Feedback to us

  • Wednesday, May 09, 2012 7:46 AM
     
     

    yaa, link is below with zip compressed

    http://dl.dropbox.com/u/6608612/MDI%20container.zip

    please help me to solve my problem.

  • Thursday, May 10, 2012 3:05 AM
    Moderator
     
      Has Code

    Hi Akshay,

      You need to put the code looks like the following into Form2_Load event handler.

      
    this.MaximizeBox = false;
    

      I feel the MaximizeBox property of Form2 wouldn't take effect when using above way.

      Hope it helps you.

    Sincerely,

    Jason Wang


    Jason Wang [MSFT]
    MSDN Community Support | Feedback to us

  • Thursday, May 10, 2012 4:29 AM
     
     

    It's not working,
    It's disabling this MaximizeBox which u can see in below picture

    but i want to disable this MaximizeBox which u can see in below picture

    I think code for this is something else not directly Form2 MaximizeBox false code.

  • Friday, August 24, 2012 12:43 AM
     
     Answered Has Code

    This works for me..

    Dim ChildForm As New System.Windows.Forms.Form
    
    ChildForm.MdiParent = Me
    
    ChildForm.MinimizeBox = False
    ChildForm.MaximizeBox = False
    ChildForm.ControlBox = False
    ChildForm.FormBorderStyle = Windows.Forms.FormBorderStyle.None
    
    ChildForm.Dock = DockStyle.Fill
    
    ChildForm.Show()

    • Edited by SuNcO Friday, August 24, 2012 12:49 AM
    • Marked As Answer by Akshay Lakhmani Friday, August 24, 2012 4:49 AM
    •  
  • Friday, August 24, 2012 4:48 AM
     
     
    Thnx a lot but i found my answer while searching on google, thnx a lot 4 the answer.