No announcement yet.
  • Filter
  • Time
Clear All
new posts

    Best way to dynamically show/hide individual items in toolstrip

    Hi, moving from layout w buttons to a toolstrip. I have the need to show/hide clickable items depending on circumstances.

    Before, i had buttons in different layouts and showed/hid the layouts depending on needs.

    Now in a toolstrip, i guess there are 2 ways

    1. Add all buttons to one toolstrip and show/hide them individually. The problem is that i then would first have to hide all, then show those that should show. Not sure how it would look visually.

    2. create separate toolstrips, add them all to layout and and show/hide the various entire toolstrips depending on what i need.

    What would you do, or is there's another, better way?

    Either is fine, and really, it comes down to how your application is structured in terms of which approach gives you the simplest, most maintainable code.

    Ultimately, you have very application-specific concerns like: are there spaces between groups of buttons? So then if you hid all the buttons in a group, but not the surrounding toolStrip, would you end up leaving an extra spacer that was intended to separate ToolStrips, even though all buttons in a given ToolStrip were hidden?

    So there is no way to give general advice, other than: it is slightly faster to do all the showing and hiding before initial draw. After draw, it is slightly faster to do all showing and hiding at the same time, rather than asynchronously at different times. But the consequence here is at most a handful of milliseconds or a very brief flash that most end users will not notice.


      Thanks! I'll go with 3 different toolstrips then.