[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [DotGNU]Winforms StatusBar
From: |
Simon Guindon |
Subject: |
RE: [DotGNU]Winforms StatusBar |
Date: |
Tue, 17 Jun 2003 23:32:25 -0400 |
Thanks Francisco, it worked out great. Much appreciated.
All that's left to do in StatusBar is the rendering now, all the
framework is coded out. Pretty simple control actually except for the
displaying.
Thanks,
Simon
-----Original Message-----
From: Francisco Figueiredo Jr. [mailto:address@hidden
Sent: June 17, 2003 9:25 PM
To: Simon Guindon
Cc: Portable. NET
Subject: Re: [DotGNU]Winforms StatusBar
Simon Guindon wrote:
> k so I've hit a little bit of an implementation wall trying to
> implement StatusBar. The problem is in the StatusBarPanelCollection,
> it inherits from IList, ICollection, Ienumerable.
>
> Ilist requires it to implement the Add(object) and such methods, but
> if you look at the MSDN docs, there is no such thing, it has
> Add(StatusBarPanel).
>
> So I decided to implement both, it compiles fine, but in the designer
> it does not react properly, when you use designer to add panels it
> adds it as Object and that's wrong because now you can't adjust the
> correct properties because their not exposed. If I don't implement
> the
> Add(object) method it just complains because it needs to be
implemented.
> So how do I get around this?
>
You have to implement the IList as an explicit interface implementation.
So, instead of having public int Add(Object value) you do it like this:
int IList.Add(Object value)
and later you can add your public int Add(StatusBarPanel panel)
There are a lot of implementations like this in the MS implementation. A
classic example is the Int32 structure. You can see that it implements
the IComparable, IFormattable and IConvertible interfaces, but in the
Int32 members you don't see any mention of IConvertible implemented
methods!
For more information, please check the excellent book: Applied Microsoft
.Net Framework Programming by Jeffrey Richter check the section:
Explicit Interface Member Implementation and the section Be careful with
Explicit Interface Method Implementation where he says that MS decided
to implement the IConvertible as explicit interface just because she
didn't want to bloat the Int32 and others documentation with all that
methods! :)
I hope it helps.
--
Regards,
Francisco Figueiredo Jr.
------
"My grandfather once told me that there are two
kinds of people: those
who work and those who take the credit. He told me
to try to be in the
first group; there was less competition there."
- Indira Gandhi
_______________________________________________
Developers mailing list
address@hidden http://dotgnu.org/mailman/listinfo/developers