Solved

Hiiding Main menu of MDI application

Posted on 2004-10-07
12
176 Views
Last Modified: 2010-08-05
Hi experts

     I need to hide a main menu of my MDI application to achieve a full screen effect.
I can hide the task bar using folowing api

[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int X, int Y,     int cx,     int cy,     uint uFlags );


But how can i achieve it for Main Menu.

Thanks n regards
Jatinder
0
Comment
Question by:jatinderalagh
  • 4
  • 3
  • 2
  • +1
12 Comments
 
LVL 18

Expert Comment

by:armoghan
ID: 12256270
just do something like this
this.Menu = null;

and add the menu again it the code when its not full size mode
0
 
LVL 11

Author Comment

by:jatinderalagh
ID: 12256389
I tried this but it kills my application by effecting some other functionality.
That's why i am intrested in hiding menubar. rather then taking it out

Regards
Jatinder

0
 
LVL 18

Expert Comment

by:armoghan
ID: 12256478
I think this is the best way to do it, as it is part of your application.
I have tried it in number of applications and it never gives any problem.
You can make a simple application and see that it works fine.

Taskbar is not part of your application so you can use above mentioned code to do it.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 11

Author Comment

by:jatinderalagh
ID: 12256784
It is giving me a problem.
My application is made up of  customized classes.
That might be the reason.
cause when i add the menu again close button  of child window(currently opened) stop working.
Is there any other possible way to achieve this.
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12256958
close button may be referencing the MainMenu some how, you can check its references

>>>Is there any other possible way to achieve this.
Sorry.. I dont know any other way so far :(
0
 
LVL 11

Expert Comment

by:Agarici
ID: 12257339
try this:

private MainMenu mnu = null;
private void Tests_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if( mnu == null )
            {
                mnu = this.Menu;
                this.Menu = null;
            }
            else
            {  
                this.Menu = mnu;
                mnu = null;
            }
        }

(this is - as you can see - a KeyPress event handler for a form - a test form in my case )


hth,
A.
0
 
LVL 11

Author Comment

by:jatinderalagh
ID: 12258209
@Agarici

I don't want to use the approach of setting Menu to null;
This approach is already defined by armoghan.

I am intrested in knowing any alterante solution to this approach

Regards
Jatinder
0
 
LVL 11

Expert Comment

by:Agarici
ID: 12258423
i understood that and i saw that armorghan posted it first

what i was suggesting (and it is only a suggestion) is: instead of using YourForm.Menu in your app to provide " some other functionality" use a MainMenu var that will never be null. when you need to show the menu, assign that var to yourForm.Menu. when you need to hide the menu, set only YourForm.Menu to null


hth,
A.
0
 
LVL 11

Author Comment

by:jatinderalagh
ID: 12460519
Hi guys

For getting full screen effect and hiding  and docking menus
We need to use CommandBar from microsoft.Office.Core namespace using this we can achieve the same effect as VS.NET studio

Thanks n Regards
Jatinder
0
 
LVL 1

Accepted Solution

by:
GhostMod earned 0 total points
ID: 12509175
PAQd, 250 points refunded.

GhostMod
Community Support Moderator
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question