Hi,
I'm trying to make some dialogs look nice in my Application. Therefore I added am UltraToolbarsManager to the form and set:Style = Office2007FormDisplayStyle=RoundedFixedon the ToolbarsManager.
It looks nice, BUT... the problem is that I'm "hosting" UserControls in it. The UserControls are designed with different sizes, so when the form hosts a UserControl it sets the ClientSize property of the form to the size of the UserControl. This works perfect for "normal" forms. But since the "nice styling" of the form (probably) is implemented without standard captionbar, borders etc and instead creates them by itself; the ClientSize and the Size of the form are the same!! Which of course cases the UserControl to not be totally visible.
Question: How do I figure out the current size of the caption, borders etc which I have to add to my clientsize?
Now I calculate the width and height (that I need to add) the way you describes. The IsHandleCreated is true; but if I set Size it is not even near to fit, but if I set the clientsize instead it fits if I add additional 2 pixels to the height...
Regards Tomas.
I would recommend iterating the Controls collection of the Form. For each control of type UltraToolbarsDockArea you come across, check its Dock property. If it is docked to the Left or Right of the Form, add its Width to your overall width you'd like to make the Form. If it is docked to the Top or Bottom of the Form, add its Height to your overall height you'd like to make the Form. Then when you are setting the new size on the Form, make sure to set the ClientSize if the Form's IsHandleCreated is False. However, if the handle is already created, set the Size. There were some sizing issues that could not be worked around for the rounded Form and this is one of them.