[Mono-winforms-list] Private ImageList methods removed in r69012
toshok at ximian.com
Wed Dec 6 11:27:10 EST 2006
visual c# express always generates assignments in the designer code for
ImageLists for ColorDepth and ImageSize, so clearly it's not making
calls to ShouldSerialize* for those properties (or they always return
true.. regardless, we don't need them in that case.)
You are right about transparentcolor - there's no way to reset it, but
ShouldSerializeTransparentColor obviously returns false when the color
is LightGray, because the assignment disappears from the output in that
So I think the best/most compatible course of action is to implement
ShouldSerializeTransparentColor (and do so in an MS compatible way,
commenting it, as opposed to fixing it and documenting the difference)
but the other methods are unnecessary.
On Wed, 2006-12-06 at 16:43 +0100, Kornél Pál wrote:
> I got some weird results (I used Visual Studio 2005):
> Private Reset... methods are ignored but private ShouldSerialize... methods
> are used.
> Previously I didn't realize this behavior.
> Note ShouldSerialize... does not affect the property browser but affects the
> designer generated code and it is definitely affected by private
> ShouldSerialize... methods.
> Previosuly I added this comment:
> // MS.NET 2.0 initializes TransparentColor to Color.Transparent in
> // constructors but ResetTransparentColor and
> // default to Color.LightGray that is treated as a bug.
> But now that .NET Framework 2.0 is already released and this wasn't fixed we
> should follow MS.NET behavior if we reintroduce the remove methods.
> The private Reset... methods are ignored by Visual Studio and I'm not sure
> whether we should implement them:
> - Implementing them is good because it provides consistency with
> ShouldSerialize... that follows the specification
> (http://msdn2.microsoft.com/en-us/library/53b8022e.aspx) and other designers
> can use it and future Visual Studio versions may use it.
> - Implementing them is useless because they are not used.
> I think we should implement ShouldSerialize... methods because they are
> ----- Original Message -----
> From: "Greg Creme" <gcreme at ncsadvantage.com>
> To: "'Chris Toshok'" <toshok at ximian.com>; "'Kornél Pál'"
> <kornelpal at gmail.com>
> Cc: <mono-winforms-list at lists.ximian.com>
> Sent: Wednesday, December 06, 2006 3:59 PM
> Subject: RE: [Mono-winforms-list] Private ImageList methods removed in
> Hi Chris,
> I had a minute so I did what you asked in vs2003.
> For the imagelist properties:
> 1. Color Depth:
> Initial: Property name is not bold, property value is not bold,
> reset disabled.
> Changed: Property name is not bold, property value becomes bold,
> reset is enabled.
> 2. ImageSize and Transparent Color (both act the same)
> Initial: Property name is not bold, property value is bold, reset
> Changed: Property name is not bold, property value is bold, reset
> Hope this helps.
> -----Original Message-----
> From: mono-winforms-list-bounces at lists.ximian.com
> [mailto:mono-winforms-list-bounces at lists.ximian.com] On Behalf Of Chris
> Sent: Wednesday, December 06, 2006 9:47 AM
> To: Kornél Pál
> Cc: mono-winforms-list at lists.ximian.com
> Subject: Re: [Mono-winforms-list] Private ImageList methods removed in
> so I just brought up visual c# express (which is admittedly 2.0) and
> none of the image list properties affected (ColorDepth, ImageSize,
> TransparentColor) acted as if they had a Reset or ShouldSerialize
> from that article, an easy way to determine this is:
> 1. select the ImageList in the design surface.
> 2. Look at its properties. If a property is in bold, it doesn't have a
> ShouldSerialize method (and also doesn't have a DefaultValue attribute,
> but that's irrelevant here).
> 3. change the value of the property, then right click on it. If the
> "Reset" item in the menu is disabled ,the property lacks a Reset method
> (and also lacks a DefaultValue attribute, but again that's irrelevant).
> in all three cases, the property was bold at the start, and the reset
> menu item was never enabled. Would someone mind doing the above 3 steps
> on those three properties inside vs2003?
> are these methods used in another context outside of designers? If not,
> I'd say removing them was the right change. If they're needed in 1.1
> I'll add them back in ifdefed for 1.1 and make them internal instead of
> private to keep the warnings down.
> On Wed, 2006-12-06 at 09:24 -0500, Chris Toshok wrote:
> > do we know that the designer in visual studio behaves as if it can call
> > these methods? The designers of course have to use reflection to find
> > the methods, but in the other cases these methods aren't private. If
> > visual studio behaves as if the methods are there, we have another piece
> > (besides the msdn docs and corcompare output) we need to look at to see
> > which methods needs implementing.
> > Chris
> > On Wed, 2006-12-06 at 14:37 +0100, Kornél Pál wrote:
> > > Hi,
> > >
> > > The removed methods were private but they were intended to be used by
> > > designers.
> > >
> > > This feauture is documented:
> > > http://msdn2.microsoft.com/en-us/library/53b8022e.aspx
> > >
> > > Also note that I noticed the behavior in Visual Studio designer that can
> > > only be implemented using these methods.
> > >
> > > And I belive that it is legal to call these methods using reflection and
> > > study their behavior altough it wasn't necessary.
> > >
> > > Applications should not rely on the presence or absence of these methods
> > > they are private but a properly implemented designer (or maybe other
> > > applications) can call these methods and the absence of these methods
> > > result in different designer behavior regarding the default property
> > >
> > > Kornél
> > >
> > > _______________________________________________
> > > Mono-winforms-list maillist - Mono-winforms-list at lists.ximian.com
> > > http://lists.ximian.com/mailman/listinfo/mono-winforms-list
> > _______________________________________________
> > Mono-winforms-list maillist - Mono-winforms-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-winforms-list
> Mono-winforms-list maillist - Mono-winforms-list at lists.ximian.com
More information about the Mono-winforms-list