Label.Image プロパティとは? わかりやすく解説

Label.Image プロパティ

Label表示されるイメージ取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

<LocalizableAttribute(True)> _
Public Property Image As
 Image
Dim instance As Label
Dim value As Image

value = instance.Image

instance.Image = value
[LocalizableAttribute(true)] 
public Image Image { get; set;
 }
[LocalizableAttribute(true)] 
public:
property Image^ Image {
    Image^ get ();
    void set (Image^ value);
}
/** @property */
public Image get_Image ()

/** @property */
public void set_Image (Image value)

プロパティ
Label表示される Image既定値null 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

Label作成しLabel後ろImage表示する方法次のコード例示します最初に、この例では Label作成しディスク ファイル基づいて Image作成します次に、その Image を含むように Size プロパティ初期化します。最後にImage プロパティImage初期化します。

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
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...

}

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.set_Size(new Size(image1.get_Width(), image1.get_Height()));

    // Initialize the label control's Image property.
    label1.set_Image(image1);
} //CreateMyLabel
// ...Code to add the control to the form...
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Label.Image プロパティ」の関連用語

Label.Image プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Label.Image プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS