Home All Groups Group Topic Archive Search About
Author
9 Jan 2006 12:13 PM
Moshazu
Take a look at the following code...

dim newLabel as new Label
with newLabel
    .autosize = true
    .text = "-00.00"
    .autosize = false
end with


Previously, in VB.NET 2003, if I were to look at the WIDTH property
after I executed the above lines of code, I would be returned a width
of about 48.

Now, I am using VB.NET 2005, and looking at the same WIDTH property, I
now am always returned a width of 100.

Is this a bug in the new VS or is this by design? If by design, why is
it this way?

Thanks for any help all,
Darian

Author
9 Jan 2006 2:55 PM
Herfried K. Wagner [MVP]
Show quote Hide quote
"Moshazu" <darianbonn***@lmicorporation.com> schrieb:
> dim newLabel as new Label
> with newLabel
>    .autosize = true
>    .text = "-00.00"
>    .autosize = false
> end with
>
>
> Previously, in VB.NET 2003, if I were to look at the WIDTH property
> after I executed the above lines of code, I would be returned a width
> of about 48.
>
> Now, I am using VB.NET 2005, and looking at the same WIDTH property, I
> now am always returned a width of 100.

Mhm.  It seems that the line '.AutoSize = False' prevents the controls from
being automatically sized, although 'AutoSize' is set to 'True' at the time
a new text is assigned to the control.  So I'd say that this behavior is not
by design.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
9 Jan 2006 3:29 PM
Moshazu
Where would I report this bug then?
Author
9 Jan 2006 5:31 PM
Herfried K. Wagner [MVP]
"Moshazu" <darianbonn***@lmicorporation.com> schrieb:
> Where would I report this bug then?

You can report the bug at
<URL:http://lab.msdn.microsoft.com/productfeedback/>.  When reporting the
bug please do not forget to post the link to the bug report here so people
can vote for the bug more easily.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
9 Jan 2006 3:43 PM
Carlos J. Quintero [VB MVP]
Hi Darian,

I don´t have a definite answer, but you can use a tool like Reflector for
..NET (http://www.aisto.com/roeder/dotnet/) to see the internal
implementation of the Autosize property and compare in different versions of
the framework.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio 2005, Visual Studio .NET,
VB6, VB5 and VBA
You can code, design and document much faster in VB.NET, C#, C++ or VJ#
Free resources for add-in developers:
http://www.mztools.com

Show quoteHide quote
"Moshazu" <darianbonn***@lmicorporation.com> escribió en el mensaje
news:1136808837.961804.109950@o13g2000cwo.googlegroups.com...
> Take a look at the following code...
>
> dim newLabel as new Label
> with newLabel
>    .autosize = true
>    .text = "-00.00"
>    .autosize = false
> end with
>
>
> Previously, in VB.NET 2003, if I were to look at the WIDTH property
> after I executed the above lines of code, I would be returned a width
> of about 48.
>
> Now, I am using VB.NET 2005, and looking at the same WIDTH property, I
> now am always returned a width of 100.
>
> Is this a bug in the new VS or is this by design? If by design, why is
> it this way?
>
> Thanks for any help all,
> Darian
>
Author
9 Jan 2006 7:11 PM
Dave Kreskowiak
It looks like this is by design.  The Width property still uses the base
Control Width property, but the AutoAdjustSize method (used internally by the
control) maintains its own width and height properties, seperate from the
Control ones.

What you're seeing with the return value of 100, is the default Width of the
control.  If AutoSize changes the width, it no longer changes the Width
property, but changes an internally maintained preferredWidth field.

If I followed the code correctly...

--
<i><b>RageInTheMachine9532</b></i><font size="-2">
"<i>...a pungent, ghastly, stinky piece of cheese!</i>" <b>-- The Roaming
Gnome</b></font>


Show quoteHide quote
"Moshazu" wrote:

> Take a look at the following code...
>
> dim newLabel as new Label
> with newLabel
>     .autosize = true
>     .text = "-00.00"
>     .autosize = false
> end with
>
>
> Previously, in VB.NET 2003, if I were to look at the WIDTH property
> after I executed the above lines of code, I would be returned a width
> of about 48.
>
> Now, I am using VB.NET 2005, and looking at the same WIDTH property, I
> now am always returned a width of 100.
>
> Is this a bug in the new VS or is this by design? If by design, why is
> it this way?
>
> Thanks for any help all,
> Darian
>
>