Form height increases on Show()
-
My application saves the Size and Location properties of the main form in a configuration file. When the program runs I first create the form, set the Size and Location properties, then call the form's Show method. I noticed after closing and restarting the application the form would grow slightly larger, which puzzled me. If I output the value of the Size property immeadiately before and after I call the form's Show method I can see that the form grows in height by exactly 19 pixels. No matter what I set as the value of the Size property, the height always seemed to increase by 19 pixels. I had a hunch maybe 19 pixels was the height of the title bar. I increased the size of the title bar font in Windows, but my form still grew by 19. However, when I increased the size of the menu font my form grew by a larger amount. Other than the menu I have two controls in the form. A ListView control with the Dock property set to Fill and a StatusBar control with the Dock property set to Bottom. Any ideas? Thanks, Chris
-
My application saves the Size and Location properties of the main form in a configuration file. When the program runs I first create the form, set the Size and Location properties, then call the form's Show method. I noticed after closing and restarting the application the form would grow slightly larger, which puzzled me. If I output the value of the Size property immeadiately before and after I call the form's Show method I can see that the form grows in height by exactly 19 pixels. No matter what I set as the value of the Size property, the height always seemed to increase by 19 pixels. I had a hunch maybe 19 pixels was the height of the title bar. I increased the size of the title bar font in Windows, but my form still grew by 19. However, when I increased the size of the menu font my form grew by a larger amount. Other than the menu I have two controls in the form. A ListView control with the Dock property set to Fill and a StatusBar control with the Dock property set to Bottom. Any ideas? Thanks, Chris
-
Maybe you can try saving and setting the form's ClientSize instead. I haven't done any testing but AFAIK the ClientSize does not include title bar height and width etc. Edbert Sydney, Australia
-
Maybe you can try saving and setting the form's ClientSize instead. I haven't done any testing but AFAIK the ClientSize does not include title bar height and width etc. Edbert Sydney, Australia