Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclass Event Calls
Message
From
28/03/2010 00:40:07
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01457639
Message ID:
01457648
Views:
41
>Thanks Bonnie.
>
>If I chose to override, I need to call the base before the subclass's resize code runs, correct?


Yes, assuming you want both methods to run.

~~Bonnie


>
>
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform