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

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

반환

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

예외

추가되는 이미지가 null인 경우

또는

추가되는 이미지가 Bitmap이 아닌 경우

이미지를 추가할 수 없는 경우

또는

추가되는 이미지 스트립의 너비가 0이거나 기존 이미지 너비와 같지 않은 경우

또는

이미지 스트립 높이가 기존 이미지 높이와 같지 않은 경우

예제

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

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

설명

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

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

적용 대상