form size height maximum - 1036 ??

  • Thread starter Thread starter ian
  • Start date Start date
I

ian

The system is not letting me increase the size (height) of the form (in the
properties window).

It lets me reduce the height, but it will not let me set it over 1036.

I need to set the form size to about 856 x 1100. (The details on the form
are intended to be printed out on A4 paper).

(I'm wondering if 1036 is the usual height that is used, and that I'm having
problems because I'm trying to print a bit closer to the top & bottom of the
page than usual)

Does anyone have any suggestions ?

Thanks, Ian. (C#)
 
* "ian said:
The system is not letting me increase the size (height) of the form (in the
properties window).

It lets me reduce the height, but it will not let me set it over 1036.

Forms must not be larger than the screen.
 
Hi ian,

All properties and methods to set the size of the form finally call
SetBondsCore method. This method is declared in the Control class. Control's
implementation doesn't restrict you to set bigger sizes for the control, but
unfrotunately that method is virtual and the Form class overrides it and
add one adjustment of the size when the form is in Normal window state not
to be bigger than SystemInfo.MaxWindowTrackSize.
As long as in C# we cannot call base-base method you cannot skip that
adjustment.

The only thing you can do is to use PInvoke and call say MoveWindows to
chage the size

[DllImport("user32.dll")]
static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int
nHeight, bool bRepaint);
private void button1_Click(object sender, System.EventArgs e)
{
MoveWindow(this.Handle, 0,0, 2000, 2000, true);
//Call UpdateBounds in order form to relayout its controls
this.UpdateBounds();
}

Don't forget to set form's MaximumSize property to some bigger value
 
Back
Top