Dialog Boxes Broken in Framework 1.1

  • Thread starter Thread starter J. W. T. Kottekoe
  • Start date Start date
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.
 
I've seen this, and also have code that exposes the problem. The difference
is that I can reproduce the problem in v1.0 of the framework and I recall
being told (by MS I reckon, on the windowsforms group) that it would be
fixed in v1.1, but after I just tested it then I see it's not fixed in v1.1
either.

Wayne.
 
Wayne,

Thanks for your reply. My code worked fine in v1.0, which is a shame because
I now have code out there that will not work for people running v1.1.
Unfortunately, it makes some of the forms unusable because the dialog box is
too small to expose all the buttons.

Does anyone know if there is an official way to report this to Microsoft so
they can fix it in upcoming releases?

J.
 
I believe you have to be "regeistered" for "support incidents". You would do
that through MSDN license agreement or there may be other means. I am
certainly not qualified to talk about the options. I know what deal my
company has, but that doesn't mean much. If you find a real bug Microsoft
tend not to count the support incident against your credit, which is nice.
I've found a couple of bugs and haven't wasted any support incidents yet.

For now though, why don't you do what I am doing for my application that
chokes on v1.1? That is, just use a config file with the necessary tags to
specify the framework version your app needs.

That is...

add the following to a config file with the same name as the exe, e.g., for
MyApp.exe the config file would be MyApp.exe.config and live in the same
path as the exe.

Then add this to the config file...

<configuration>
<startup>
<supportedRuntime version="v1.0.3705"/>
</startup>
</configuration>

That will force machines with both 1.0 and 1.1 to use 1.0.

Regards,
Wayne.
 
Back
Top