Is the size of a Form in Visual Studio designer limited to screen resolution?

后端 未结 8 473
时光取名叫无心
时光取名叫无心 2020-11-27 19:13

Why is it, that in the Visual Studio WinForms designer I cannot increase the size of my Form above the resolution of the screen I am currently working on? I think it should

相关标签:
8条回答
  • 2020-11-27 19:56

    Thanks all, especially Ben Schwehn! With the info provided above, if your app uses a base form, you can make the following changes (in C#) which will remove the limitation from all forms inherited from it.

    [DllImport("user32.dll", EntryPoint = "MoveWindow")]
    private static extern bool MoveWindow(IntPtr hWnd, int x, int y, int w, int h, bool repaint);
    
    protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
    {
        base.SetBoundsCore(x, y, width, height, specified);
        MoveWindow(Handle, x, y, width, height, true);
    }
    
    0 讨论(0)
  • 2020-11-27 19:57

    I am working on a design that uses a vertical screen, 1080x1920. Sometimes I need to work on the main form on a different machine that does not have a vertical screen. Every time I work on the main form, the form resolution is forced to 1080x1109. What a pain. The only thing I can do is make the changes, then use Windows multiscreen to change the desktop so one monitor is above the other. Then extend the design window to span 2 monitors, then manually change the size of the form. There is no way this "feature" is not a bug.

    0 讨论(0)
提交回复
热议问题