I have a problem with showing small form – I want the form to be in size (5,100) but when I’m trying to show it the form size is bigger then I want. My code:
Form form = new Form();
form.StartPosition = FormStartPosition.Manual;
form.ShowInTaskbar = false;
form.FormBorderStyle = FormBorderStyle.None;
form.Size = new Size(5, 100);
form.MaximumSize = new Size(5, 100);
form.Show();
// form.Size = new Size(5, 100); - works but with flicker
I can change size after showing the form but then I have flicker.
What can I do

Problem with showing form with small size.
Tippy
Use that code in onpaint event
this.Width=100;
this.Height=5;
so it'll stay in same size..
SkyHighRanks
Questa
I've disabled almost everything(minimize,maximize buttons,etc.) but the result was the same...
Does anyone know the answer
sillywilly78
If you are using franework V2 you can set the FormBorderStyle property to 'FixedToolWindow' as follows...
Form form = new Form();
form.StartPosition = FormStartPosition.Manual;
form.ShowInTaskbar = false
form.FormBorderStyle = FormBorderStyle.FixedToolWindow
form.Size = new Size(5, 100);
form.MaximumSize = new Size(5, 100);
form.Show();
// form.Size = new Size(5, 100); - works but with flicker
The 'Size' property then works as for any control.
At this small size you propbably want to hide the control box (minimize maximize etc..) as well i.e.
form.ControlBox = false
Hope this helps.
Tim Lensen
After chasing this up, it appears that when the Form is getting created by Windows, its size is updated to be greater than or equal to SystemInformation.MinimumWindowSize. There doesn't seem to be a way to prevent this from happening, however, as tehlike stated, if you override OnPaint and set the size in that, it 'seems' to work:
protected override void OnPaint(PaintEventArgs e)
{
this.Size = new Size(5, 100);
base.OnPaint(e);
}