J
J. W. T. Kottekoe
Has anyone else seen dialog boxes that worked fine in Framework 1.0 but are
too small in Framework 1.1? This drove me crazy until I found a work around.
It seems to be truly a bug in v1.1, so I hope Microsoft can fix it. I'm glad
to provide a project file demonstrating the problem if someone from
Microsoft is reading this.
The problem occurs in a fixed size dialog box in which the ControlBox
property has been set to false in the designer. If I create the form and
then programmatically change it's position, the height of the form is
reduced by the height of the title bar. The problem does not occur if the
dialog box is made visible before it is moved. I was able to fix this by
setting the ControlBox property AFTER creating the dialog box, instead of
having it set within the InitializeComponent() method. Here are some code
snippets to reproduce the problem.
Create a "Flaky" dialog box containing the following designer generated
code:
private void InitializeComponent()
{
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(112, 29);
this.ControlBox = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "Flaky";
this.Text = "Flaky";
}
Then, instantiate and show it using this code:
// Doesn't work
flaky = new Flaky();
flaky.Left=100;
flaky.Show();
When this is done, the resulting dialog box will be smaller in height than
what appears in the designer. The problem goes away if I comment out the
line that moves the dialog box (flaky.Left=100), or move that line to occur
after showing the dialog box. Neither of these fixes will work in my
application. However I can make it work by eliminating the line
"this.ControlBox=false" from the class definition and putting it in the code
that displays the dialog box, thus:
// Does work
flaky = new Flaky();
this.ControlBox = false;
flaky.Left=100;
flaky.Show();
Now that I know how to fix it, this is not a real problem, merely an
irritation. The problem is for people who have written valid code that works
in Framework 1.0 only to find their dialog boxes not working properly when
their users upgrade to Framework 1.1
J.W.T.
too small in Framework 1.1? This drove me crazy until I found a work around.
It seems to be truly a bug in v1.1, so I hope Microsoft can fix it. I'm glad
to provide a project file demonstrating the problem if someone from
Microsoft is reading this.
The problem occurs in a fixed size dialog box in which the ControlBox
property has been set to false in the designer. If I create the form and
then programmatically change it's position, the height of the form is
reduced by the height of the title bar. The problem does not occur if the
dialog box is made visible before it is moved. I was able to fix this by
setting the ControlBox property AFTER creating the dialog box, instead of
having it set within the InitializeComponent() method. Here are some code
snippets to reproduce the problem.
Create a "Flaky" dialog box containing the following designer generated
code:
private void InitializeComponent()
{
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(112, 29);
this.ControlBox = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "Flaky";
this.Text = "Flaky";
}
Then, instantiate and show it using this code:
// Doesn't work
flaky = new Flaky();
flaky.Left=100;
flaky.Show();
When this is done, the resulting dialog box will be smaller in height than
what appears in the designer. The problem goes away if I comment out the
line that moves the dialog box (flaky.Left=100), or move that line to occur
after showing the dialog box. Neither of these fixes will work in my
application. However I can make it work by eliminating the line
"this.ControlBox=false" from the class definition and putting it in the code
that displays the dialog box, thus:
// Does work
flaky = new Flaky();
this.ControlBox = false;
flaky.Left=100;
flaky.Show();
Now that I know how to fix it, this is not a real problem, merely an
irritation. The problem is for people who have written valid code that works
in Framework 1.0 only to find their dialog boxes not working properly when
their users upgrade to Framework 1.1
J.W.T.