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
07/08/2004 11:36:24
 
 
À
06/08/2004 22:37:56
Czarina Joyce Villanueva
Innovision Systems International
Manila, Philippines
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00931505
Message ID:
00931543
Vues:
22
Sounds like you have a few issues here. First, you've defined your image incorrectly. There are two ways to do images. One is to have an ImageList collection from which you choose an image. The other, which it sounds like you probably want to do, is to get the image from a file.
this.Image = System.Drawing.Image.FromFile("images\newreq.bmp");
When you say "the caption" on the button, do you mean the name of the button or what gets displayed on the button? I don't imagine you mean what gets displayed on the button (the Text, since you're using an Image). If you mean the Name, then that's normal behavior when you drop a control on a form for it to be named that way (i.e. bbButtonOK1). You can change the Name property to whatever you want in the form's Property Sheet for your button.

~~Bonnie


>I have this code to create my own class but when I dropped it in my form after added it in my Tools, the caption defined and the image is not appearing. The caption appearing is still bbButtonOk1. Anything missing here?
>
>public class bbButtonOk : System.Windows.Forms.Button {
>    public bbButtonOk() {
>	this.ForeColor = Color.Black;
>	this.Text = "&MyCaption";
>	this.Image = "images\newreq.bmp";
>    }
>}
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