需要知道 Visual Basic 2010 中单击的 PictureBox 数组元素的索引和标记。 标记和索引作为公共整数变量变暗。Gbox是 PictureBox 数组的名称。Tag = sender.tag有效。 Index = NameofArray.Indexof(sender as PictureBox)不起作用,Index = clicked.Indexof(sender as PictureBox)也不起作用
Private Sub Gbox_Click(sender As Object, e As EventArgs)
Dim clicked As PictureBox = CType(sender, PictureBox)
SelectedColor.Image = clicked.Image
Tag = sender.tag
Index = Gbox.IndexOf(sender as picturebox) 'Does not work
Index = clicked.Indexof(sender as PictureBox) ' Does not work
End Sub
我需要在计算中使用预先分配的标签和索引。感谢您的帮助。