How to perform Form AutoScale in C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mylixes
    New Member
    • May 2010
    • 29

    #1

    How to perform Form AutoScale in C#

    I am working on a PC with 1280x1024 resolution.
    Now, my problem is how could my program automatically adjust its forms and all of the controls if I am going to run my program to other PC/laptop with different resolution?

    Currently, I set the AutoScaleMode property of the form to Dpi but it doesn't work

    Any help will be highly appreciated.
  • ThatThatGuy
    Recognized Expert Contributor
    • Jul 2009
    • 453

    #2
    Originally posted by mylixes
    I am working on a PC with 1280x1024 resolution.
    Now, my problem is how could my program automatically adjust its forms and all of the controls if I am going to run my program to other PC/laptop with different resolution?

    Currently, I set the AutoScaleMode property of the form to Dpi but it doesn't work

    Any help will be highly appreciated.
    Windows forms will automatically scale up the form , if its WindowState property is set to Maximized...

    so you don't need to worry...

    Comment

    • mylixes
      New Member
      • May 2010
      • 29

      #3
      Originally posted by ThatThatGuy
      Windows forms will automatically scale up the form , if its WindowState property is set to Maximized...

      so you don't need to worry...
      Form WindowState property is not set to Maximized as it should not be. So, how could do that?

      Comment

      • ThatThatGuy
        Recognized Expert Contributor
        • Jul 2009
        • 453

        #4
        Originally posted by mylixes
        Form WindowState property is not set to Maximized as it should not be. So, how could do that?
        so if you set it to Maximized then it will adjust to any screen resolution

        Comment

        • mylixes
          New Member
          • May 2010
          • 29

          #5
          Originally posted by ThatThatGuy
          so if you set it to Maximized then it will adjust to any screen resolution
          I can't set it to Maximized.
          I mean, I should not set it to maximized. So how could I auto re-sized the form if the resolution is different without the need of maximizing the form.

          Comment

          • GaryTexmo
            Recognized Expert Top Contributor
            • Jul 2009
            • 1501

            #6
            Well, if you design your form by setting the anchors on your controls properly, they should resize/position themselves based on the size of the host form.

            Would that work for you? It's the "Anchor" property on anything inheriting from Control.

            Comment

            • mylixes
              New Member
              • May 2010
              • 29

              #7
              Originally posted by GaryTexmo
              Well, if you design your form by setting the anchors on your controls properly, they should resize/position themselves based on the size of the host form.

              Would that work for you? It's the "Anchor" property on anything inheriting from Control.
              I tried to use anchor already, but it doesn't work as I want it to be.

              Comment

              • ThatThatGuy
                Recognized Expert Contributor
                • Jul 2009
                • 453

                #8
                Originally posted by mylixes
                I am working on a PC with 1280x1024 resolution.
                Now, my problem is how could my program automatically adjust its forms and all of the controls if I am going to run my program to other PC/laptop with different resolution?

                Currently, I set the AutoScaleMode property of the form to Dpi but it doesn't work

                Any help will be highly appreciated.
                I think there's no way you gonna learn the preferable way..

                Use Screen.PrimaryS creen.Bounds.Wi dth and Screen.PrimaryS creen.Bounds.He ight to get the visible screen size ....

                Comment

                Working...