How to force a .net (under ms windows) form control (eg a button) to be always rectangular ?
I want it to be able to change it's size but be always rectangular.
How to force a .net (under ms windows) form control (eg a button) to be always rectangular ?
I want it to be able to change it's size but be always rectangular.
This depends on the way the OS handles the shape for buttons.
The visual style for a button will be different in different windows OS. It won't be same in windows XP and windows Vista.
A good article can be found here.
When you are creating a button by dragging it to the designer the code for button creation and initialization is added to the form. You can create your own button class (inherited from button) and make sure that every time button is created its height is equal to width. If not - make height equal to width or width equal to height. Then if you are using this class youll be always able to change button size, but it will remain rectangular. If you want to make all the buttons on the form rectangular at once, without changing their type to some custom type, but add this feature (to be rectangular) as you are adding help notes, you can use IExtender. This is a good thing to make all classes of particular type to have abilities you like them to have. If you need more details - please, let me know.