Who invokes DrawItem in ListBox? I'm stuck with a problem...

Winston

Junior Contributor
Joined
Jan 25, 2003
Messages
266
Location
Sydney, Australia
Hey guys, i've been making my custom control lately, i'm extending from the standard listbox, and providing a Shadowing property that shadows Items, providing my own collection type, i've extended from collection base implemented the actual methods for the custom collection type all fine as well, i've also provided my ListBoxItem type, that's what the custom collection type holds, and i've also implemened a typeconverter for this ListBoxItem. All good code gets generated. Now i've set up all this stuff. Basically in general the DrawItem event that i normally override and provide functionality for, provides the DrawItemEventArgs as a parameter, and i normally am able to retrieve the Index of the current list item being drawn, but right now the issue is, when i add like say 4 - 5 custom ListBoxItem types in my own Shadowed Item property, and when i run the code, the index i retrieve is ONLY -1. What could be the problem?

Thanks Guys.
 
Damn man...

If you're trying to create a all new ListBox, why are you inheriting from the Windows.Forms one?? :p

My opinion is that you're messing with too many core objects of the control and it's not handling it...
If not anyone have some real solution for you, pick up your code, detach it from the inheritance and create your own ListBox control... :D

Alex :p
 
Back
Top