ImageList.ImageCollection.AddStrip(Image) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Adiciona uma faixa de imagem para a imagem especificada ao 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
Parâmetros
Devoluções
O índice da imagem recém-adicionada, ou -1 se a imagem não puder ser adicionada.
Exceções
A imagem não pode ser adicionada.
-ou-
A largura da faixa de imagem a ser adicionada é 0, ou a largura não é igual à largura da imagem existente.
-ou-
A altura da faixa de imagem não é igual à altura da imagem existente.
Exemplos
O exemplo a seguir demonstra como usar AddStripo . Para executar este exemplo, cole o código seguinte num formulário Windows que contenha um ImageList chamado imageList1 e um botão e chame o método AddStripToCollection neste exemplo ao tratar o evento Click do botão.
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
Observações
O número de imagens a adicionar é inferido a partir da largura da imagem dada.
Uma tira é uma única imagem tratada como múltiplas imagens dispostas lado a lado.