Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subclass Event Calls
Message
De
28/03/2010 00:19:10
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01457639
Message ID:
01457646
Vues:
48
Hi Kevin,

You have a couple of options:

1) Make the base event handler protected virtual. That way you can override it in the sub-class rather than create another event handler in the sub-class.

-or-

2) Don't create an eventhandler and simply override the OnResize method in both the base and the sub-class.

Either way is acceptable.

~~Bonnie




>I have a panel called pnlBase. It has a few controls on it. In the Resize event I have:
>
>
>private void pnlBase_Resize(object sender, EventArgs e)
>{
>    lblCurrentUserName.Left = Width - lblCurrentUserName.Width - 20;
>    
>    cmdNext.Top = Height - cmdNext.Height - 10;
>    cmdNext.Left = Width - cmdNext.Width - 25;
>
>    cmdPrevious.Top = cmdNext.Top;
>    cmdPrevious.Left = cmdNext.Left - cmdNext.Width - 10;
>}
>
>
>I then subclassed the panel into pnlQuery. In it's resize I have:
>
>
>private void pnlQuery_Resize(object sender, EventArgs e)
>{
>    if (txtQuantities != null)
>    {
>        txtQuantities.Left = Width - txtQuantities.Width - 15;
>        txtSearchWords.Left = Width - txtQuantities.Width - 5;
>
>        txtSearchWords.Height = Height - cmdNext.Top - 5;
>        txtQuantities.Top = txtSearchWords.Top;
>    }
>}
>
>
>When I run it it jumps back & forthe between the 2 events, and the controls don't end up where I want them. What's the right way to
>do this?
Bonnie Berent DeWitt
NET/C# MVP since 2003

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

Click here to load this message in the networking platform