Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AfterInitializeComponent() ??
Message
 
To
12/11/2004 13:13:10
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00960888
Message ID:
00960943
Views:
7
Thanks,

Good idea, this fixes the problem in a very simple way. you know i have to "unlearn" VFP.

>Stephane,
>
>I wouldn't have handled the maximize/minimize boxes that way. A cleaner way is to handle it in the custom Resizable property's set method:
>
>public bool Resizable
>{
>   get {return this._Resizable;}
>   set {
>	this._Resizable = value;
>	this.MaximizeBox = this._Resizable;
>	this.SizeGripStyle = this._Resizable ? System.Windows.Forms.SizeGripStyle.Show : System.Windows.Forms.SizeGripStyle.Hide;
>	this.FormBorderStyle = this._Resizable ? System.Windows.Forms.FormBorderStyle.Sizable : System.Windows.Forms.FormBorderStyle.FixedSingle;
>	this.MinimizeBox = this._Resizable;
>       }
>}
>
>
>~~Bonnie
>
>
>
>>Thanks Bonnie,
>>
>>I did that and it works but, what happend is the form appear and for a split second you can see the MaximizeBox And MinimizeBox disapear if my custom property Resizable if false. It's just not very clean. Any ideas ?
>>
>>heres the code:
>>
>>
>>protected internal void AfterInitializeComponent()
>>{
>>	
>>	// Resisable
>>	this.MaximizeBox = this.Resizable;
>>	this.SizeGripStyle = this.Resizable ? System.Windows.Forms.SizeGripStyle.Show : System.Windows.Forms.SizeGripStyle.Hide;
>>	this.FormBorderStyle = this.Resizable ? System.Windows.Forms.FormBorderStyle.Sizable : System.Windows.Forms.FormBorderStyle.FixedSingle;
>>	this.MinimizeBox = this.Resizable;
>>				
>>	
>>}
>>
>>>Stephane,
>>>
>>>The base class's constructor executes in it's entirety before the derived class's constructor, so you wouldn't be able to put a call to an AfterInitializeComponent() in the constructor of the base class. But, a class's Load event fires next (after both constructors, base and derived), so you could put a call to an AfterInitializeComponent() in your base class's Load event handler (which will execute in it's entirety before the derived class's Load event).
>>>
>>>~~Bonnie
>>>
>>>
>>>
>>>>Another C# newbie question...
>>>>
>>>>I want to put in a base class, code that would execute right after the Default constructor of the derived class.
>>>>
>>>>Where would i put this code ? And make sure it'always executed.
>>>>
>>>>Thanks
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform