Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Frinds,
iam using C#.Net Windows Application..In my project have different module that will be used by MDI..
now what the problem is,i can open a new form mean, in right top corner they will display icon as maximize,minimize and Close in both MDI and Menustrip..
I want to show only the icon in MDI..how can Remove child forms icons(Maximize,Minimize and Close) from menustrip
Posted

try this
There is property named MaximizeBox, set it false and
another named MinimizeBox set it false.

C#
private const int CP_NOCLOSE_BUTTON = 0x200;
protected override CreateParams CreateParams
{
    get
    {
       CreateParams myCp = base.CreateParams;
       myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON ;
       return myCp;
    }
}
 
Share this answer
 
v2
Comments
MichealRay 22-Jun-13 12:22pm    
Basmeh Awad, ya its working...but it will only disable Close Button Only..then wht about the Maximize and Minimize icon..i Set False to the Max and Min Property, but cant Disable...And the code will use in each and every form?....
Basmeh Awad 22-Jun-13 12:28pm    
yes..the code you will have use in every form...
i didnt understand this "then wht about the Maximize and Minimize icon.."
didnt you set the property to false in forms property window
MichealRay 22-Jun-13 12:48pm    
yes,i Set False to the Max and Min Property, but cant Disable
Basmeh Awad 23-Jun-13 2:47am    
you can hide the button by setting true or false in runtime..but there is no property like disable..
Hi Friends,
I solved this problem,In the child form load event i have set the following properties,
C#
this.ControlBox = false;
this.MaximizeBox = false;
this.MinimizeBox = false;

But, even-though you could not Success, go to the designer page under FormName put this,
C#
this.ControlBox = false;
this.ShowIcon = false;
 
Share this answer
 
Private Sub Form4_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If Me.WindowState = FormWindowState.Minimized Then
Me.WindowState = FormWindowState.Normal
End If

End Sub
 
Share this answer
 
Comments
CHill60 17-Jun-14 12:56pm    
Apart from the fact the question is a year old, your solution is VB (OP tagged C#) and is completely the wrong way to go about it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900