ImageList.ImageCollection.AddStrip(Image) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將指定影像的影像條帶加入 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
參數
傳回
新新增影像的索引,或 -1 若無法新增影像。
例外狀況
範例
下列範例示範如何使用 AddStrip。 要執行此範例,請將以下程式碼貼入包含一個名為 ImageListimageList1 及一個按鈕的 Windows表單,並在處理按鈕的 AddStripToCollection 事件時呼叫此範例中的 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
備註
新增圖片數量是根據給定圖片的寬度推算出來的。
條帶是一張單一影像,被視為多張並排排列的影像。