We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Making ToolStripItems Spring/Stretch

Thread ID:





95242 Jun 28,2010 03:42 PM UTC Jul 5,2010 01:08 PM UTC WinForms 1
Tags: Tools
Shannon McCoy
Asked On June 28, 2010 03:42 PM UTC

While creating a web browser app I was a little surprised that there is no easy way to set a ToolStripItem to spring or stretch as you can in a StatusStripEx. After trying a bunch of stuff and getting close myself I opened a ticket and got some great help (Special thanks to Vallarasu S.) and I thought it my help others to post the answer here. I have included a sample app that demonstrates it both in SDI and MDI form.

Sizing turned out to be tricky because you cannot use the position of adjacent controls to help you. In the tool strip the items do not have Top, Left, Bottom, Right or location properties. all you have are the sizes. So I figured find the size of the whole strip and add everything up. Add the padding, margins etc. And sub tracked that from the size of the strip and and you have your new width. Now where to put it? Hmmm.... Well it turns out the right place is to override the Layout event and put it in there. All is demonstrated and commented in the code example. Hope this helps someone.

Shannon McCoy


Vallarasu S [Syncfusion]
Replied On July 5, 2010 01:08 PM UTC

Hi Shannon,

Thanks for using Syncfusion products and your contribution to the Syncfusion Community Forums.

Vallarasu S.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon