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. Visual Basic
  4. Resizing a form in code

Resizing a form in code

Scheduled Pinned Locked Moved Visual Basic
question
9 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.
  • D Offline
    D Offline
    Drew
    wrote on last edited by
    #1

    What, in your opinion, is the best way to store/retrieve form sizes?

    L 1 Reply Last reply
    0
    • D Drew

      What, in your opinion, is the best way to store/retrieve form sizes?

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      :confused:

      Luc Pattyn [Forum Guidelines] [My Articles]


      this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


      D 1 Reply Last reply
      0
      • L Luc Pattyn

        :confused:

        Luc Pattyn [Forum Guidelines] [My Articles]


        this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


        D Offline
        D Offline
        Drew
        wrote on last edited by
        #3

        I'm trying to have a form that automatically saves it's size and state. I've got the state part down, but I now need the size part. If anyone has ideas for a form location part I'm open for ideas? Robust code would be nice :)

        L 1 Reply Last reply
        0
        • D Drew

          I'm trying to have a form that automatically saves it's size and state. I've got the state part down, but I now need the size part. If anyone has ideas for a form location part I'm open for ideas? Robust code would be nice :)

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          :confused: you already are saving and restoring the state, whatever that may be (visible, minimized, maximized, ... ?). But you ask about the size, which is just two numbers ? Whatever scheme you have choosen, add a couple of lines to it, two to write a number, and two to four to read and parse a number. :)

          Luc Pattyn [Forum Guidelines] [My Articles]


          this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


          D 1 Reply Last reply
          0
          • L Luc Pattyn

            :confused: you already are saving and restoring the state, whatever that may be (visible, minimized, maximized, ... ?). But you ask about the size, which is just two numbers ? Whatever scheme you have choosen, add a couple of lines to it, two to write a number, and two to four to read and parse a number. :)

            Luc Pattyn [Forum Guidelines] [My Articles]


            this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


            D Offline
            D Offline
            Drew
            wrote on last edited by
            #5

            I get the following problem (probably because I didn't parse correctly): Expression is a value and therefore cannot be the target of an assignment. Is there a better way to do this: Me.Size.Height = My.Settings.MainFormHeight ' I have a setting called MainFormHeight

            L 1 Reply Last reply
            0
            • D Drew

              I get the following problem (probably because I didn't parse correctly): Expression is a value and therefore cannot be the target of an assignment. Is there a better way to do this: Me.Size.Height = My.Settings.MainFormHeight ' I have a setting called MainFormHeight

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              OK, now I see your problem. Form has Size property, and Size has a Height property, both have getters and setters; nevertheless you can not change a Form's height by doing Form.Size.Height=somevalue; instead you should create a new instance of Size with the right values in the constructor, then assign this to Form.Size :)

              Luc Pattyn [Forum Guidelines] [My Articles]


              this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


              D 1 Reply Last reply
              0
              • L Luc Pattyn

                OK, now I see your problem. Form has Size property, and Size has a Height property, both have getters and setters; nevertheless you can not change a Form's height by doing Form.Size.Height=somevalue; instead you should create a new instance of Size with the right values in the constructor, then assign this to Form.Size :)

                Luc Pattyn [Forum Guidelines] [My Articles]


                this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


                D Offline
                D Offline
                Drew
                wrote on last edited by
                #7

                Excellent! Works great! I can tell it to look at a variable too, right?

                L T 2 Replies Last reply
                0
                • D Drew

                  Excellent! Works great! I can tell it to look at a variable too, right?

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #8

                  Sorry, I once more don't know what you mean by that. But probably yes.

                  Luc Pattyn [Forum Guidelines] [My Articles]


                  this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google


                  1 Reply Last reply
                  0
                  • D Drew

                    Excellent! Works great! I can tell it to look at a variable too, right?

                    T Offline
                    T Offline
                    The ANZAC
                    wrote on last edited by
                    #9

                    you should also be able to save the form size as a size value in settings as oppose to two seperate settings.

                    Please check out my articles: The ANZAC's articles

                    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