首页 > 解决方案 > 循环通过位图数组

问题描述

Dim bmpNew As Bitmap = Nothing
Dim Bitmaps(15) As Bitmap

For b = 0 To Bitmaps.Count - 1
    If Bitmaps.Contains(bmpNew) Then
    Else
        If Bitmaps(b) Is Nothing Then
            If Bitmaps(b) Is bmpNew Then
            Else
                Bitmaps(b) = bmpNew
            End If
        Else
        End If
    End If
    ListBox1.Items.Add(b)
Next

我正在开发一个应用程序,每次按下按钮时都会生成随机图像。生成图像后,它会遍历最初为空的位图数组。它应该做的是用它创建的每个新图像填充数组,同时确保如果它已经存在于数组中,则不要添加它。我已经尝试了很多尝试,这种方法是唯一真正有意义并且非常接近我想要实现的方法,但它仍然会在我的数组中产生重复项。

我错过了什么?

标签: arraysvb.netbitmap

解决方案


推荐阅读