vb.net - Automatically adjusting winform and controls to screen size -


I have created a conform application, each screen size is 1361, 768 pixels, it is very large for large screens and / or laptops Works fine but now I have to take my application on 10inch screen tablet, which means that my application is not fit.

I have never had to deal with this issue before, before you can adjust the size of each form and adjust all, when looking at the small screen, there are controls and panels?

I am VS I am using 2012.

P

is possible to make fully scalable in WinForms, but it works a little good news That this work is done at design-time, to properly control the control so that all can be done automatically by framework for themselves. It's annoying, but it's not difficult. Enjoy that you do not have to write scaling code manually, as you did with VB6

There are four fundamental properties that you need to familiarize yourself with:

  • Previous There should be two quite familiar web developers who know CSS, they do the same thing here. Padding controls the difference around a control, while the margin controls the external margin. To ensure this you have to set it correctly that your control can "breathe" because the automatic scaling code is just jam against each other.

    The "control" Windows desktop application is approximately 12 "15 pixels. You should make sure that you at least leave this room then add additional margins / padding as you separate things I have a good context for reference. I have another good reference.

    The next step is to instruct the layout manager how you want to organize and resize control. The key is to think in terms of the container control and children controls, the form itself has a container control, and you can limit the anchor or dock to its children You can set controls, one or more of these child controls may contain a container control, and the control of his child can be unprotected or docked in its boundaries. Closer is unlimited, but for your own discretion and proper Radra performance, you want to keep it at the appropriate minimum.

    A good way to do this is to use two provided invisible layout assistants, and . Personally, I have not found very useful for Windows first, at least for standard Windows applications. But TableLayoutPanel is invaluable.

    Fill out my complete form with a TableLayoutPanel (margin = 0, doc = filling) what I'll do. After this I will add personal control (or sometimes other nested tablet-panel) to my cells. Those margins will be set properly by those hair controls, and their anchors or doc properties will be set, depending on it Does I want the control to take shape in a certain size or dynamically?

    Before you how to contact these properties and how it all works, you will probably need to play your layout with a little bit, make a backup of your form and then just move it. Or, it may be easy to start each form with a scratch (you can still copy and paste different controls to protect your other properties). After all, all this will start to understand for you, and you will get up and go in a moment.

    The big deal is that once all of it is ready, then what you need to do is to make sure your form is resizable, then the user manually changes it again or max / Using the Restore button, it will automatically fill your screen size, it works well for all DPI settings, which is another common initiative of WinForms devs.

  • Comments

    Popular posts from this blog

    Java - Error: no suitable method found for add(int, java.lang.String) -

    java - JPA TypedQuery: Parameter value element did not match expected type -

    c++ - static template member variable has internal linkage but is not defined -