Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to set up a control after siting is complete?
Message
De
19/02/2007 13:34:30
 
 
À
19/02/2007 12:50:53
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
OS:
Windows 2000 SP4
Divers
Thread ID:
01196991
Message ID:
01197100
Vues:
15
>Have you seen any clearer documentation on how this is supposed to behave?

No, not really. But, it works for the purpose I need it to, so that's good enough for me. <g>

~~Bonnie


>Hi,
>
>I don't think it would ever have occurred to me to try the OnCreateControl...
>AFAICS, from a bit of testing, it doesn't seem to execute until the containing form's Show() is executed ??? Help also says it fires the CreateControl event but there doesn't seem to be one.....
>
>Have you seen any clearer documentation on how this is supposed to behave?
>Best,
>Viv
>
>
>>You're welcome Viv.
>>
>>That one took a bit of trial-and-error. I needed similar functionality for my CodesComboBox class. In 1.1, we used the BindingContextChanged event, but once we started using 2.0 that event caused problems (the items in the ComboBox doubled-up) ... it took me awhile to come up with the OnCreateControl event.
>>
>>~~Bonnie
>>
>>
>>
>>>Hi Bonnie,
>>>
>>>Just tried it and it works. Thanks!
>>>Looks as if it doesn't fire until after the containing form's InitalizeComponent() has completed which is exactly what a need but a bit counter-intuitive given that all of it's properties have been set and it's been added to the form before the event fires :-{
>>>
>>>Thanks again,
>>>Viv
>>>
>>>>
>>>>Have you tried the OnCreateControl event?
>>>>
>>>>~~Bonnie
>>>>
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>I have a class derived from the Panel control that is used on several forms. Currently this class creates its own Toolstrip in its constructor.
>>>>>
>>>>>Now there is a requirement for the toolstrip content to vary (slightly) depending on which form it is sited on so I've added a couple of public properties to the panel to control the toolstrip creation (intending to set these at design time in each form)
>>>>>
>>>>>Obviously the toolstrip creation can now longer be handled by the constructor but I can find no other obvious panel event to use. I thought ParentChanged() might work but this fires when the control is added to the form and the auto-generated code does this before initializing the properties.
>>>>>
>>>>>Any suggestions on how to do this (I really don't want to have to explicitly call a panel function from the containing form)
>>>>>
>>>>>TIA,
>>>>>Viv
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform