ImageList.ImageCollection.AddStrip(Image) 메서드

정의

지정된 ImageList이미지의 이미지 스트립을 .에 추가합니다.

public:
 int AddStrip(System::Drawing::Image ^ value);
public int AddStrip(System.Drawing.Image value);
member this.AddStrip : System.Drawing.Image -> int
Public Function AddStrip (value As Image) As Integer

매개 변수

value
Image

추가할 이미지가 있는 A Bitmap 입니다.

반품

새로 추가된 이미지의 인덱스이거나 이미지를 추가할 수 없는 경우 -1.

예외

추가되는 이미지는 .입니다 null.

-또는-

추가되는 이미지는 .가 Bitmap아닙니다.

이미지를 추가할 수 없습니다.

-또는-

추가되는 이미지 스트립의 너비가 0이거나 너비가 기존 이미지 너비와 같지 않습니다.

-또는-

이미지 스트립 높이가 기존 이미지 높이와 같지 않습니다.

예제

다음 예제에서는 사용 AddStrip하는 방법을 보여 줍니다. 이 예제를 실행하려면 단추의 ImageList 이벤트를 처리할 때 imageList1라는 AddStripToCollection 및 단추를 포함하는 Windows Form에 다음 코드를 붙여넣고 이 예제에서 Click 메서드를 호출합니다.

public void AddStripToCollection()
{
    // Add the image strip.
    Bitmap bitmaps = new Bitmap(typeof(PrintPreviewDialog), "PrintPreviewStrip.bmp");
    imageList1.Images.AddStrip(bitmaps);
    
    // Iterate through the images and display them on the form.
    for (int i = 0; i < imageList1.Images.Count; i++) {
    
        imageList1.Draw(this.CreateGraphics(), new Point(10,10), i);
        Application.DoEvents();
        System.Threading.Thread.Sleep(1000);
    }
}
Private Sub AddStripToCollection() 
    ' Add the image strip.
    Dim bitmaps As New Bitmap(GetType(PrintPreviewDialog), "PrintPreviewStrip.bmp")
    imageList1.Images.AddStrip(bitmaps)
    
    ' Iterate through the images and display them on the form.
    For i As Integer = 0 To imageList1.Images.Count - 1
        
        imageList1.Draw(Me.CreateGraphics(), New Point(10, 10), i)
        Application.DoEvents()
        System.Threading.Thread.Sleep(1000)
    Next
 
End Sub

설명

추가할 이미지 수는 지정된 이미지의 너비에서 유추됩니다.

스트립은 나란히 정렬된 여러 이미지로 처리되는 단일 이미지입니다.

적용 대상