Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I put default images and captions in my class?
Message
De
12/08/2004 10:25:17
 
 
À
12/08/2004 00:47:13
Czarina Joyce Villanueva
Innovision Systems International
Manila, Philippines
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00931505
Message ID:
00932711
Vues:
19
Hmmmm ... you're right, the Text on the button changes when you drop it in the IDE. I had an existing sub-classed button on a Form and I simply went to the button class and changed the Text and added an image. When I went back to look at my form the button had the new text and image, so at that point I hadn't tested actually dropping it on my form since it was already there. But, now that I've tested it I see the problem. And here's the solution:

Instead of putting the this.Text = "MyButton" in the constructor, create an EventHandler for the HandleCreated event (since a button doesn't have a load) and put it there instead.
	private void BBButton_HandleCreated(object sender, EventArgs e)
	{
		this.Text = "MyButton";
	}
~~Bonnie
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