set a form size more than 2128:1860 - c#

I need to let a form get bigger than 2128:1860 which seems to be the biggest dimension.
how can I expand it?
I've already tried expanding it via properties
I'm working with Visual Studio, in C#

The maximum value for a form size is based on the resolution of the screen:
From the docs:
The maximum value of this property is limited by the resolution of the
screen on which the form runs. The value cannot be greater than 12
pixels over each screen dimension (horizontal + 12 and vertical + 12).

Related

How to guarantee contents dimensions of WPF window are always the same regardless of window trim thickness?

Using this image to clearly show the problem:
Red box background image
If I do this in Visual Studio...
Designer layout A
... the image gets clipped because the trim of the window is fatter at runtime than the pseudo-trim in VS designer:
Runtime dimensional change A
If I increase the window size in Visual Studio to look like this...
Designer layout B (with window size increased to match Windows 7 trim thickness)
... the result looks correct:
Runtime dimensions look correct... for Windows 7 trim thickness only
I've tried the same steps with and without a window Grid. The result is the same.
————
As a point of reference, macOS/Cocoa windows are defined by the size of their content area to avoid this problem.
In other words, if I set a window in Xcode to be 300 x 300, at runtime its content view frame will always be 300 x 300 regardless of how Apple changes the window trim dimensions from version to version of the OS.
————
What is the WPF method of achieving window-trim-agnostic content dimensions?
Use GetSystemMetrics to tell you the width and hight of the border to the window (via SM_CXSIZEFRAME & SM_CYSIZEFRAME) and add it to the size of window you are opening or resizing.

Form oversize than setting

My working laptop is 1920 x 1080. C# form size set to the 1920 x 1080 with Top most set as true, and window state set to maximum. A panel was sized to 1850 x 500. Here is the part that puzzled me, the form displayed during debugged was wider than the screen, the panel was wider and the left edge was not displayed.
This the first time I come across this. Any idea how to resolve this?
One more thing: the Screen.PrimaryScreen.Bounds value is 1536 x 864
why not 1920 x 1080 ?
Hans Passant is correct.
I checked my dell development notebook (window 10 home), the default and recommended "Change the size of text, apps, and other items:" was set at 125%.
I tried and test the same project files at another desktop ( which has a default setting at 100%).
voila : the normal display like WYSIWYG ! A hard lesson learned. I had to rework all the UI all over again.

Set form size does not match the size of displayed form

My question is very simple but I searched and searched and could not find the answer.
I am using .NET 4.0 c#. I size my displayed form width to exact 10 inches (measured by ruler) on my screen, and this.Size.Width shows 946. I expect 960 because HorizontalResolution shows 96. I tried with different sizes and always got ratio 94.6 instead of 96.
This is definitely not measurement error, but what causes the discrepancy?

Set window height to be larger than screen height

Does anyone know if its actually possible to set the height of a window such that it is greater than the screen size using C#?
I tried something like this on several windows:
SetWindowPos(handle, new IntPtr(0), 0, 0, 1024, 4000,
SetWindowPosFlags.SWP_SHOWWINDOW);
However, they never go past the screen size - is there a way around this?
No its not allowed though you are using SetWindowPos the MSDN docs on Form.Size property says:
The maximum value of this property is limited by the resolution of the screen on which the form runs. The value cannot be greater than 12 pixels over each screen dimension (horizontal + 12 and vertical + 12).

.NET vScrollBar Questions

Can anyone tell me why the formula for the the actual maximum Value of a vScrollBar control is Maximum + LargeStep -1?
Is there a way to configure the control so that the Value is 0 when the scroll bar is at the bottom of the screen?
LargeChange is the size of the button that slides in a vScrollBar. Since the top part of the slider cannot slide all the way to the bottom, the maximum change is the vScrollBar.Maximum minus the size of the slider, and the size of the slider is set to be equal to the LargeChange.
You can set the minumum to be zero (plus largeCharge plus 1) to get it the be zero at the bottom. However, the other values will be negative. Maybe a better way is to subtract the value from the maximum in the scroll event and assign that to a variable:
scrollValue = VScrollBar1.Maximum - VScrollBar1.Value - VScrollBar1.LargeChange + 1
You may want to add the LargeValue to the vScrollBar1.Maximum.

Categories