Sign in to follow this  

[.net] Weird issue in designer with custom control inheriting ToolStrip

Recommended Posts

I wrote a custom control based on ToolStrip in order to support better system styling by integrating a renderer that use uxtheme. The other goal was to enable me to create sort of "radio button" groups to get radio button functionality for ToolStripButtons. Everything seemed to work fine until I noticed a strange problem, and I'm not sure how to fix it. If you create a custom control based on a ToolStrip, when you put the custom ToolStrip down in the designer, and build the project, the form will actually shrink ~21 pixels each time you build the project. It doesn't take anything special to achieve, so it really has nothing to do with any of the bells and whistles I added to my custom ToolStrip control. In order to reproduce the problem, I created a custom control that inherited from ToolStrip and did nothing more than call the ToolStrip's default constructor. Upon building the project, the form shrank. Does anyone know why specifically this is happening? Am I just going to have to deal with this and fix the form size every time I build, and enforce the default size in the forms constructor? Edit: After a little more research I've learned that this only happens if you use the original MainMenu control on the same form. This is an unavoidable situation for me. I still can't figure out why it's happening. I'm assuming the form is reducing in size based on the MainMenu height. It still only happens with inherited ToolStrips though. ToolStrips by themselves even in the presence of a MainMenu does not shrink the form.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this