0

I'm currently developing in a monitor with a resolution of 1920 x 1080, then I crated a release version of my system to test on my notebook (1366 x 768) then I saw that some screens was too big. To fix this I opened visual studio in my big monitor changing its resolution to the same as my note (1366x768) to have a better perspective on how to proceed, but for my surprise, when I opened my form (.cs file design mode) automatically the form resized itself changing its height from 868 to 788, in one of then.

If I open the .cs file with high resolution, then change the resolution back to 1366, the form don't resize, but if I close the tab and open it again, the form will once again "adapt" its heigth to the new resolution. WHYY??

EDIT: As requested, a print of my form properties:

properties image from one form

EDIT²: I notice that when I change the resolution, and change form's size, each resolution has it's own maximun size, 1920x1080 for example it's 1100 height, 1366x768 it's 788 height. So if the resolution is 1366x it just don't let me up more than 788... weeeird.

Well, I found an answer... I just can't create a form bigger than screen resolution: Is the size of a Form in Visual Studio designer limited to screen resolution?

  • Do you mean the preview in the form editor? This is just a preview. – Nico Schertler Jun 20 '19 at 01:09
  • Yeah! But when I compile the changes keep! – Diego Bittencourt Jun 20 '19 at 01:10
  • So you are saying that the editor is proactively changing the form properties based on the screen resolution? I find that hard to believe. – Nico Schertler Jun 20 '19 at 01:11
  • That's what's happening. – Diego Bittencourt Jun 20 '19 at 01:13
  • Can you print the window properties to the console and see the actual values? I'm guessing you are observing some DPI-dependent variables that are calculated from the actual size based on display settings. – Nico Schertler Jun 20 '19 at 01:15
  • added print to main post. – Diego Bittencourt Jun 20 '19 at 01:20
  • You haven't accidentally explicitly set the window size in the constructor of the form or edited the `InitializeComponent` function manually have you? – Prime Jun 20 '19 at 01:36
  • Nop! All changes was commented and the problem persist. I notice that when I change the resolution, and change form's size, each resolution has it's own `maximun size`, 1920x1080 for example it's 1100 height, 1366x768 it's 788 height. So if the resolution is 1366x it just don't let me up more than 788... weeeird. – Diego Bittencourt Jun 20 '19 at 01:55
  • 1
    Set `AutoScaleMode` to `Dpi`, it will add something like `this.AutoScaleDimensions = new SizeF(96F, 96F)` in the designer. [Make your app DPIAware](https://stackoverflow.com/a/13228495/7444103). – Jimi Jun 20 '19 at 02:33
  • @Jimi Same result. The problem is that I can't create a form with a height bigger than resolution's height. EDIT: Answer: https://stackoverflow.com/questions/6651115/is-the-size-of-a-form-in-visual-studio-designer-limited-to-screen-resolution – Diego Bittencourt Jun 20 '19 at 03:18
  • I know that. You can resize/scale a Form at run-time. When your app is DPIAware, you can easily do that, since all the properties/methods/Win32 functions will return physical measures instead of virtualized ones. Also, ScrollBars exit for a reason. If you designed your app so that all controls are child of the same Window, you have a design problem. Not all of your users have 4k screens. – Jimi Jun 20 '19 at 03:34

0 Answers0