Label.Image Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Lekéri vagy beállítja a rendszerképet, amely egy Label.
public:
property System::Drawing::Image ^ Image { System::Drawing::Image ^ get(); void set(System::Drawing::Image ^ value); };
public System.Drawing.Image Image { get; set; }
public System.Drawing.Image? Image { get; set; }
member this.Image : System.Drawing.Image with get, set
Public Property Image As Image
Tulajdonság értéke
Megjelenik Image a Label. Az alapértelmezett érték a null.
Példák
Az alábbi példakód bemutatja, hogyan hozhat létre és Label jeleníthet meg egy Image mögöttes Labelkódot. Először a példa létrehoz egy Label , majd egy Image lemezfájlon alapuló fájlt. Ezután a Size tulajdonság inicializálva lesz, hogy tartalmazza a Image. Végül a Image tulajdonság inicializálva lesz a Image.
public:
void CreateMyLabel()
{
// Create a new label and create a bitmap.
Label^ label1 = gcnew Label;
Image^ image1 = Image::FromFile( "c:\\MyImage.bmp" );
// Set the size of the label to accommodate the bitmap size.
label1->Size = System::Drawing::Size( image1->Width, image1->Height );
// Initialize the label control's Image property.
label1->Image = image1;
// ...Code to add the control to the form...
}
public void CreateMyLabel()
{
// Create a new label and create a bitmap.
Label label1 = new Label();
Image image1 = Image.FromFile("c:\\MyImage.bmp");
// Set the size of the label to accommodate the bitmap size.
label1.Size = new Size(image1.Width, image1.Height);
// Initialize the label control's Image property.
label1.Image = image1;
// ...Code to add the control to the form...
}
Private Sub CreateMyLabel()
' Create a new label and bitmap.
Dim Label1 As New Label()
Dim Image1 As Image
Image1 = Image.FromFile("c:\\MyImage.bmp")
' Set the size of the label to accommodate the bitmap size.
Label1.Size = Image1.Size
' Initialize the label control's Image property.
Label1.Image = Image1
' ...Code to add the control to the form...
End Sub
Megjegyzések
A Image tulajdonság nem használható a tulajdonsággal és ImageList a ImageIndex tulajdonsággal egy időben. Amikor a Image tulajdonság egy kép megjelenítésére szolgál, a ImageListImageIndex rendszer automatikusan az alapértelmezett beállításokra állítja a tulajdonságokat.