0

Continue from the overlay window's incorrect size problem. So here is the minimum system:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Size = new Size(1920, 1080);
            MessageBox.Show("x:" + this.Size.Width + " y:" + this.Size.Height);
        }
    }
}

It says my window size is 1438x818 (even though it does appear to fill the desktop area of the screen)....

Did some new research The problem starts to occur when my size is set larger than 14xx by 83x Any size larger than that will be restricted to 14xx by 83x if I say

this.size = new Size (500,500);

then it is okay...

[Final edit] Well. I think I found the problem. https://social.msdn.microsoft.com/Forums/vstudio/en-US/60e3b413-7746-46d4-8351-0c7f4e38378f/does-form-size-has-any-limitation-like-maximum-width-or-maximum-height?forum=netfxbcl

The form size does have a hidden limit and it seems that fixing it is out of my ability as an indie developer. I cannot find where is a hidden limitation is..

What I need to do is map the logic coordinate of anything in my form to a new world coordinate based on 1436/1920 scale ratio. Problem bypassed.

mjwills
  • 23,389
  • 6
  • 40
  • 63
wildbill16
  • 11
  • 4
  • What is your screen resolution – TheGeneral Nov 07 '18 at 05:32
  • 1920x1080................ – wildbill16 Nov 07 '18 at 05:34
  • why not just `this.WindowState = FormWindowState.Maximized;` – TheGeneral Nov 07 '18 at 05:35
  • It might be a hidden scaling property issue. It covers the the device's screen but the message box report 1431x774. I am finding where the scale stuff is at... – wildbill16 Nov 07 '18 at 05:39
  • If you create a completely new Form **in a completely new solution**, and copy that code into the `Form_Load` of that form, does it exhibit the same behaviour? – mjwills Nov 07 '18 at 06:17
  • Hi@mjwills, yes it repeats. The problem is solved in another way though. (Written the update of the question..) – wildbill16 Nov 07 '18 at 06:24
  • What is your scale and layout set to? https://www.cnet.com/how-to/6-display-settings-you-should-be-using-in-windows-10/ – mjwills Nov 07 '18 at 07:38
  • @mjwills...I forgot that earlier this year I use a custom scale: 135%......Might be it..I'll validate it. – wildbill16 Nov 08 '18 at 05:29
  • Your application is not DPIAware. Thus subject to virtualization: `1920/1431 = 1.34 = ~135%`. Set your app as DPIAware and the screen measure will be reported as the physical size. [How to configure an app to run correctly on a machine with a high DPI setting](https://stackoverflow.com/questions/13228185/how-to-configure-an-app-to-run-correctly-on-a-machine-with-a-high-dpi-setting-e?answertab=active#tab-top). Some notes on the [virtual screen and display disposition](https://stackoverflow.com/questions/53012896/c-sharp-user32-using-setwindowpos-with-multiple-monitors?answertab=active#tab-top). – Jimi Nov 08 '18 at 16:22

2 Answers2

1

If you want to set size as 1920x1080 you can try this.

this.MinimumSize = new Size(1920, 1080);
this.MaximumSize = new Size(1920, 1080);
D-Shih
  • 44,943
  • 6
  • 31
  • 51
  • It covers the screen area between the task bar and the title bar of the form..But the message box still report 1416x756... – wildbill16 Nov 07 '18 at 05:37
0

The size of the form must be lesser than or equal to current screen size.

Besides you can change the ClientSize of the form by

this.ClientSize = new System.Drawing.Size(1920, 1080);

Nishil
  • 227
  • 1
  • 9
  • There is probably a limit property somewhere..But I cannot find it.But I don't know why it happens at 14xx by 83x.... – wildbill16 Nov 07 '18 at 06:00