dotnetmonitor.com |
|
||||||||||||
ToolStripItem is the abstract base class for all
the items that go into a ToolStrip. The functionality here is quite extensive. Notable
is core eventing, Text, Image, sizing, TextImageRelation, DisplayStyle, Alignment,
Owner.
ImageImages in ToolStrips are supported via direct property set or via ImageList support (runtime only). Also supported are animated GIFs and .ICO files.
NOTE: Image usage is demonstrated in several SDK samples. TextImageRelationToolStripItem exposes a TextImageRelation property that defines the relative placement of the Image with respect to the Text. It special cases image null or empty text and lays those items out without having a blank spot for the missing element.
NOTE: The launching shell of the SDK ToolStripSamples sample demonstrates TextImageRelation. DisplayStyleDisplayStyle allows you to set values into the Text and Image property, but only display what you want. This is handy for changing only the display style when showing the same item in a different context. An example would be showing on the Image in an overflow or quick list.
NOTE: See SDK sample on dynamic display style alteration to handle window resizing. Available vs VisibleIn ToolStrips, Visible always returns the true state of the item and its container. That means if you check the visible property of the ToolStripMenuItem before it is ever shown it will be visible false. Available is what youd want to use in that case which means it will try to lay that item out. This is regardless of whether itll end up in the overflow or Placement = none.
If you are using DataBinding, Available is better to databind against than the Visible property, as the Visible property also returns the state of its container in the case of a ToolStripDropDown, an item is usually going to be Visible=false, but Available=true. How can I tell when the mouse is over a ToolStripButton?Use the Selected property for items in which "CanSelect" is true. Otherwise you'll have to sync MouseEnter, MouseLeave events. You can check for Selected in your custom Renderer as well. |
||||||||||||
|
||||||||||||