Solved

Hiiding Main menu of MDI application

Posted on 2004-10-07
12
174 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 11

Author Comment

by:jatinderalagh
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 11

Expert Comment

by:Agarici
Comment Utility
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
Comment Utility
@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
Comment Utility
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
Comment Utility
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
Comment Utility
PAQd, 250 points refunded.

GhostMod
Community Support Moderator
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now