wildbill16
wildbill16

Reputation: 11

New form is not reporting its size as I expect

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.

Upvotes: 0

Views: 73

Answers (2)

Nishil
Nishil

Reputation: 227

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);

Upvotes: 0

D-Shih
D-Shih

Reputation: 46219

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

this.MinimumSize = new Size(1920, 1080);
this.MaximumSize = new Size(1920, 1080);

Upvotes: 1

Related Questions