Use different screen resolution according to the monitor

Asked

Viewed 207 times

0

I am developing an application in 1920x1080, but the Pcs that will run are 1280x720 and 1366 x 768.

When I run in mine it looks exactly as I want, but when I run in these resolutions, a lot is broken. Is there any way to adjust it? Or I have to make a code for every different resolution?

  • Be more specific. Is it preferable to post the code where it happens, is a component not in the right place? Take a step by [tour] to better understand how the site works. And see how to write a [mcve]

  • It has no code, I just leave a button in the property SIZE 200x50, and in other resolutions it left for example 260x60. but the panel that contains them, has a maximum size of 200x540, in this the last buttons are from the view

  • Did any of the answers solve your question? Do you think you can accept one of them? Check out the [tour] how to do this, if you haven’t already. You would help the community by identifying what was the best solution for you. You can accept only one of them. But you can vote on any question or answer you find useful on the entire site (when you have enough score).

2 answers

3

Have it, do it all over again considering it’s gonna run on a machine that’s not yours and never believe in

funciona na minha máquina

one of the most famous programming memes.

  • Or you redo all screens thinking of the minimum common denominator, in case 1280x720 (but may appear lower)
  • or does several layouts for each resolution
  • or uses a layout of Windows Forms (see below)
  • or switch to WPF which is best suited for these cases because it can present both more information on the screen and can present the same information larger or smaller if it has more or less screen space (it is possible to simulate this in Winforms, but it is quite complicated).

The most common is to use one FlowLayoutPanel, but it may be that the TableLayoutPanel Class serve you well. You can see other classes panels that help in layout, you can see some of them derived from the class Panel, and it is possible you create your dashboard, but it takes work. Obviously you have to know how to use it properly so that the layout is appropriately flexible.

Another common form is the use of Control.Anchor that establishes where a control should start to be placed. If you know how to anchor everything can get an interesting result. You can combine the two.

But test on multiple resolutions, it doesn’t always look good in some cases.

  • Flowlayoutpanel also works horizontally? because I already use it in a dropdown menu , but vertically

  • https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.flowlayoutpanel.flowdirection?view=netframework-4.8

2

Windows Forms has certain limitations for creating responsive forms.

In these cases of resolution I always build the forms in the lowest resolution that the system will run and I use the anchors and panels, for example, so I can keep the form as adjustable as possible.

If your need is a form that accepts maximum resolution features, I suggest you do it in WPF.

Hugs

  • 1

    ANCORA!!!! that’s what I was looking for!! vlw I forgot this option existed!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.