Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET C#4.0 .NET4 WinForm
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 22-Jun-13 6:56am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

try this
There is property named MaximizeBox, set it false and
another named MinimizeBox set it false.
 
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;
    }
}
  Permalink  
v2
Comments
guyzfree at 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 at 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
guyzfree at 22-Jun-13 12:48pm
   
yes,i Set False to the Max and Min Property, but cant Disable
Basmeh Awad at 23-Jun-13 2:47am
   
you can hide the button by setting true or false in runtime..but there is no property like disable..
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi Friends,
I solved this problem,In the child form load event i have set the following properties,
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,
this.ControlBox = false;
this.ShowIcon = false;
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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
  Permalink  
Comments
CHill60 at 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)

  Print Answers RSS
0 OriginalGriff 390
1 Jochen Arndt 150
2 Richard MacCutchan 135
3 DamithSL 95
4 Garth J Lancaster 90
0 OriginalGriff 6,045
1 DamithSL 4,601
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,260


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 17 Jun 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100