Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Form height increases on Show()

Form height increases on Show()

Scheduled Pinned Locked Moved C#
questionworkspace
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cmaissan
    wrote on last edited by
    #1

    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

    E 1 Reply Last reply
    0
    • C cmaissan

      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

      E Offline
      E Offline
      Edbert P
      wrote on last edited by
      #2

      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

      J C 2 Replies Last reply
      0
      • E Edbert P

        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

        J Offline
        J Offline
        Jun Du
        wrote on last edited by
        #3

        I had similar problem long time ago, but I don't remember exactly how I solved it. It was sort of the caption bar that added up every time. - It's easier to make than to correct a mistake.

        1 Reply Last reply
        0
        • E Edbert P

          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

          C Offline
          C Offline
          cmaissan
          wrote on last edited by
          #4

          I am definately using Size, not ClientSize. I also believe it is the height of the menu bar that is being added to the form, not the height of the title bar.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups