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

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ImageList.ImageSize プロパティの意味・解説 

ImageList.ImageSize プロパティ

イメージ リスト内のイメージサイズ取得または設定します

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

<LocalizableAttribute(True)> _
Public Property ImageSize As
 Size
Dim instance As ImageList
Dim value As Size

value = instance.ImageSize

instance.ImageSize = value
[LocalizableAttribute(true)] 
public Size ImageSize { get; set;
 }
[LocalizableAttribute(true)] 
public:
property Size ImageSize {
    Size get ();
    void set (Size value);
}
/** @property */
public Size get_ImageSize ()

/** @property */
public void set_ImageSize (Size value)

プロパティ
リスト内のイメージの高さと幅をピクセル単位定義する Size既定サイズ16 × 16 です。最大サイズ256 × 256 です。

例外例外
例外種類条件

ArgumentException

代入された値が IsEmpty と同じです。

または

高さまたは幅の値が 0 以下です。

または

高さまたは幅の値が 256超えてます。

ArgumentOutOfRangeException

新しサイズが 0 未満か、256超えてます。

解説解説
使用例使用例

ImageList構築しImages プロパティイメージ追加しImageSize プロパティ設定してDraw メソッド使用するコード例次に示します。この例を実行するには、Button1 という名前のボタン配置されフォーム中にこの例を配置します。この例では、c:\Windows\ に FeatherTexture.bmp および Gone Fishing.bmp置かれていることを前提としています。これらのビットマップシステム存在しない場合、または他の場所存在する場合は、必要に応じて例を変更してください

Friend WithEvents ImageList1 As
 System.Windows.Forms.ImageList

' Create an ImageList Object, populate it, and display
' the images it contains.
Private Sub Button1_Click(ByVal
 sender As System.Object, _
    ByVal e As System.EventArgs) Handles
 Button1.Click

    ' Construct the ImageList.
    ImageList1 = New ImageList

    ' Set the ImageSize property to a larger size 
    ' (the default is 16 x 16).
    ImageList1.ImageSize = New Size(112, 112)

    ' Add two images to the list.
    ImageList1.Images.Add(Image.FromFile _
        ("c:\windows\FeatherTexture.bmp"))
    ImageList1.Images.Add _
        (Image.FromFile("C:\windows\Gone Fishing.bmp"))

    Dim count As System.Int32

    ' Get a Graphics object from the form's handle.
    Dim theGraphics As Graphics = Graphics.FromHwnd(Me.Handle)

    ' Loop through the images in the list, drawing each image.
    For count = 0 To ImageList1.Images.Count
 - 1
        ImageList1.Draw(theGraphics, New Point(85, 85), count)

        ' Call Application.DoEvents to force a repaint of the form.
        Application.DoEvents()

        ' Call the Sleep method to allow the user to see the image.
        System.Threading.Thread.Sleep(1000)
    Next
End Sub

internal System.Windows.Forms.ImageList ImageList1;

// Create an ImageList Object, populate it, and display
// the images it contains.
private void Button1_Click(System.Object sender,
 
    System.EventArgs e)
{

    // Construct the ImageList.
    ImageList1 = new ImageList();

    // Set the ImageSize property to a larger size 
    // (the default is 16 x 16).
    ImageList1.ImageSize = new Size(112, 112);

    // Add two images to the list.
    ImageList1.Images.Add(
        Image.FromFile("c:\\windows\\FeatherTexture.bmp"));
    ImageList1.Images.Add(
        Image.FromFile("C:\\windows\\Gone Fishing.bmp"));

    // Get a Graphics object from the form's handle.
    Graphics theGraphics = Graphics.FromHwnd(this.Handle);

    // Loop through the images in the list, drawing each image.
    for(int count = 0; count < ImageList1.Images.Count;
 count++)
    {
        ImageList1.Draw(theGraphics, new Point(85, 85), count);

        // Call Application.DoEvents to force a repaint of the form.
        Application.DoEvents();

        // Call the Sleep method to allow the user to see the image.
        System.Threading.Thread.Sleep(1000);
    }
}

internal:
   System::Windows::Forms::ImageList^ ImageList1;

private:

   // Create an ImageList Object, populate it, and display
   // the images it contains.
   void Button1_Click( System::Object^ /*sender*/, System::EventArgs^
 /*e*/ )
   {
      
      // Construct the ImageList.
      ImageList1 = gcnew ImageList;
      
      // Set the ImageSize property to a larger size 
      // (the default is 16 x 16).
      ImageList1->ImageSize = System::Drawing::Size( 112, 112 );
      
      // Add two images to the list.
      ImageList1->Images->Add( Image::FromFile( "c:\\windows\\FeatherTexture.bmp"
 ) );
      ImageList1->Images->Add( Image::FromFile( "C:\\windows\\Gone Fishing.bmp"
 ) );
      
      // Get a Graphics object from the form's handle.
      Graphics^ theGraphics = Graphics::FromHwnd( this->Handle
 );
      
      // Loop through the images in the list, drawing each image.
      for ( int count = 0; count < ImageList1->Images->Count;
 count++ )
      {
         ImageList1->Draw( theGraphics, Point(85,85), count );
         
         // Call Application.DoEvents to force a repaint of the form.
         Application::DoEvents();
         
         // Call the Sleep method to allow the user to see the image.
         System::Threading::Thread::Sleep( 1000 );

      }
   }
private System.Windows.Forms.ImageList imageList1;

// Create an ImageList Object, populate it, and display
// the images it contains.
private void button1_Click(Object sender, System.EventArgs
 e)
{
    // Construct the ImageList.
    imageList1 = new ImageList();
    // Set the ImageSize property to a larger size 
    // (the default is 16 x 16).
    imageList1.set_ImageSize(new Size(112, 112));
    // Add two images to the list.
    imageList1.get_Images().Add(Image.FromFile(
        "c:\\windows\\FeatherTexture.bmp"));
    imageList1.get_Images().Add(Image.FromFile(
        "C:\\windows\\Gone Fishing.bmp"));
    // Get a Graphics object from the form's handle.
    Graphics theGraphics = Graphics.FromHwnd(this.get_Handle());
    // Loop through the images in the list, drawing each image.
    for (int count = 0; count < imageList1.get_Images().get_Count();
 
        count++) {
        imageList1.Draw(theGraphics, new Point(85, 85), count);
        // Call Application.DoEvents to force a repaint of the form.
        Application.DoEvents();
        // Call the Sleep method to allow the user to see the image.
        System.Threading.Thread.Sleep(1000);
    }
} //button1_Click
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS