Menu Control ( 2.0)

  • Thread starter Thread starter VJ
  • Start date Start date
V

VJ

Is there any way I can make the main menu bar for a MDI windows forms
application, floating and hidden.. anybody know of the trick?
 
I do not believe that this is supported anymore. I spent several hours
trying to get it working a couple months back and gave up. I did figure out
how to get several toolstrips into an application and allow them to dock to
any side of the application window. It is not obvious. This is just from
memory, so don't take this little code snippet literally, but here's my
memory of how I did it.

In my case, I wanted to let the user dock toolstrips on any side of the
application. Toolstrips need a ToolStripPanel to dock in. A ToolStripPanel
is good for just one edge in the application so I needed 4, one for each
edge. There were declared as data members of the main form as:

// Class
public partial class MainForm : Form
{
// Data members /////////////////////////////////
ToolStripPanel tspTop = new ToolStripPanel();
ToolStripPanel tspBottom = new ToolStripPanel();
ToolStripPanel tspLeft = new ToolStripPanel();
ToolStripPanel tspRight = new ToolStripPanel();

public MainForm()
{
// Add the ToolStripPanels to the form in reverse order.
// The toolstrips must be added to the form's controls list
// before InitializeComponent or the menu will display
// UNDER the toolbars instead of the menu bar being at the
// top of the application window.
Controls.Add(tspRight);
Controls.Add(tspLeft);
Controls.Add(tspBottom);
Controls.Add(tspTop);

InitalizeComponent();

// Now dock the toolstrip panels to the main window.
tspTop.Dock = DockStyle.Top;
tskBottom.Dock = DockStyle.Bottom;
tspLeft.Dock = DockStyle.Left;
tspRight.Dock = DockStyle.Right;

// Now the toolstrips themselves can be inserted into the Top toolstrip
panel.
// Assume that the toolstrips tsStandard and tsDrawing were
// created in the normal fashion in the designed.
tspTop.Join( tsStandard );
tspTop.Join( tsDrawing );
}
 
Thanks Richard, Knowledge is handy. I am really looking to do the float,.
isn't there a native API way. I am sure you would have hit all that. we have
to write custom code; more on below lines I was thinking,

On Full screen click
1. Remove menubar ( and Window Title )
On Mousemove outside top window area
2. Show menubar
On Exit Full Screen
3. Chk, add menu back..

Thats just the algorithm.. may not float, but can get things done..in close
possible way...

HTH , you in some. I am going to try this over the weekend, if get a code
outline working, I will post.
VJ
 
Back
Top