Windows Develop Bookmark and Share   
 index > Windows Forms Designer > ToolStrip Disappears
 

ToolStrip Disappears

In Visual Studio 2005 during design time my toolstrip disappears when I click any part of the form. Selecting the control in the properties window combo brings the control back onto the screen.

At run time the toolbar is no where to be seen.

Can anyone help me with this

thanks

Coder11  Monday, June 12, 2006 2:44 PM

OK I sorted this out,

It appears that some jokerchanged the visible property to false which gives rise to the strange design time behaviour.

nice

Coder11  Monday, June 12, 2006 3:08 PM

OK I sorted this out,

It appears that some jokerchanged the visible property to false which gives rise to the strange design time behaviour.

nice

Coder11  Monday, June 12, 2006 3:08 PM

This happens to us on a regular basis when the toolstrip is inside in a tab control. Depending on which which tab is visible, what the last action you did before building/running the app, the phase of the moon on so on the toolbar on the current tab page will magically have its Visible property set to false.

It is annoying to keep having to turn it back on so I ended up writing code to recurse through the form's controls andmake all of the toolstrips visibleevery time on the load event.

We still have to monkey around to select the toolstrip in order to make design time changes but at least we aren't accidentally releasing test builds with missing toolbars (at runtime) anymore.

Jeff

Jeff McBride  Thursday, July 27, 2006 8:41 PM

Jeff,

I can confirm the very similar problem. Please read my thread from here:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1545076&SiteID=1&mode=1

Marek

Marek Zgadzaj  Tuesday, May 01, 2007 8:23 PM
I've been encountering this problem also, whenever I put a toolstrip on a tabpage, it keeps disappearing. For some reason it keeps getting set to Visible = False even though I am not doing that, is there a proper fix for this yet?
Russell Maidment  Thursday, May 31, 2007 11:49 AM

I do not know of any official fix or work-around. Here is thefix that I came up with. Just call EnsureToolbarsAreVisible(this) from your form load code.

Jeff

public void EnsureToolbarsAreVisible(Form formFix)
{
if (formFix != null)
EnsureToolbarControlsAreVisible((Control.ControlCollection)formFix.Controls);
}

public void EnsureToolbarControlsAreVisible(Control.ControlCollection ctrls)
{
if (ctrls != null)
{
try
{
foreach (Control ctrl in ctrls)
{
ToolStrip ts = ctrl as ToolStrip;
TabControl tc = ctrl as TabControl;
SplitContainer sc = ctrl as SplitContainer;

if (ts != null)
ts.Visible = true;
else if (tc != null)
{
foreach (TabPage tp in tc.TabPages)
EnsureToolbarControlsAreVisible((Control.ControlCollection)tp.Controls);
}
else if (sc != null)
{
EnsureToolbarControlsAreVisible((Control.ControlCollection)sc.Panel1.Controls);
EnsureToolbarControlsAreVisible((Control.ControlCollection)sc.Panel2.Controls);
}
else if (ctrl.Controls != null)
EnsureToolbarControlsAreVisible((Control.ControlCollection)ctrl.Controls);
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
}

Jeff McBride  Thursday, May 31, 2007 4:42 PM
Ah nice, thanks

still annoying in design time when making changes, surprised that Microsoft haven't fixed this obvious bug yet, considering it's been here for so long
Russell Maidment  Thursday, May 31, 2007 5:21 PM

If you are using a ToolStripContainer you should also checkout for the TopToolStripPanelVisible property.

Visual Studio Form designer sets this to false when you click on different ToolStrips.

If you want all your TopToolStripPanes visible consider extending the code above for a fix, if not set the appropriate TopToolStripPanelVisible property in your own code, otherwise change the Designer generated code and never use the designer again (Thank god Big Smile)

Tiago Dias  Thursday, June 07, 2007 12:17 PM
Visual Studio 2008 still has this problem. It's a bug in the winform designer and has been around for years. It's so irritating and ahuge issue for us as we can't release without constantly checking to see that these are still visible. We're starting to lose confidence in the designer, especially after all this time.

Webbbb  Tuesday, April 15, 2008 2:26 AM

Hi All,

Because I had to many Toolstrips into tabs controls and it became a nightmare to find the hiden ones, I did a very small add-in to put the visible property to true again.

Here is the add-in:
http://membre.oricom.ca/frabla/controls/FrablaToolstripVisibilityFix/SetupFrablaToolstripVisibilityFix.msi

I hope that it will be usefull for anyone who have the same problem! Cheer!

Frank


joo  Tuesday, April 22, 2008 10:24 PM

Ho! I forgot to say that add-in is made for VS2005, I don't know if it works with 2008!


joo  Tuesday, April 22, 2008 10:25 PM
Yeah, this doeshave to do withthe visibility settings. I found the problem toonesimiliar issue as well that's been around for 4 years.I already posted the work around solution at the link below.

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=119591&wa=wsignin1.0
yanike  Monday, April 20, 2009 7:10 AM

You can use google to search for other answers

Custom Search

More Threads

• Is there any way to change the coordinate origin of a form away from the top left?
• How to custom draw ListView or other common controls like TreeView?
• Controls emulating Mac interface
• exception when opening complex C# form in design mode
• Form has no MdiParent property in the properties window
• Help! Get Resource Reference in Windows Application at Design Time
• Why are new UserControl classes abstract ?
• Designer is not getting loaded for main form??
• How to design an irregular shape button??
• Create Code for Handler/delegate of control