ToolStripItem.Visible Property
.NET Framework 4
Gets or sets a value indicating whether the item is displayed.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
There should be a reference to the 'Available' property
The Visible property is closely related to the Available property.
Getting the Visible property gives you the actual state of the object, i.e. if you can see it on the screen, it returns Visible = true , and getting the Available property is more what we would expect from the previous behaviour, which is roughly the answer to the question: 'will it become visible if I click on its parent'
Getting the Visible property gives you the actual state of the object, i.e. if you can see it on the screen, it returns Visible = true , and getting the Available property is more what we would expect from the previous behaviour, which is roughly the answer to the question: 'will it become visible if I click on its parent'
After setting, Visible state cannot be read back immediately
Note that if you set item.Visible, you will not be able to see the change in your debugger, or read it back from your code immediately.
i.e. The first example below will exhibit unexpected behaviour, while the second one works:
item.Visible = DecideIfItemIsVisible();
if (item.Visible)
...
bool isVisible = DecideIfItemIsVisible();
item.Visible = isVisible;
if (isVisible)
...
- 8/20/2010
- Jason Williams