Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AfterInitializeComponent() ??
Message
De
12/11/2004 13:13:10
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00960888
Message ID:
00960941
Vues:
7
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
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