-1
我试图对多个图片框执行相同的操作,但下面的代码的第一行正在生成这个错误:无法强制类型'System.Windows.Forms.Button'类型的对象类型'System.Windows.Forms.PictureBox'
Unable to cast object of type System.Windows.Forms.Button to type System.Windows.Forms.PictureBox
所以我想知道是否有人可以帮助。提前致谢。
For Each pb As PictureBox In Me.Controls
Dim bp As New Bitmap(pb.Image)
pb.Region = GetRegion(bp, Color.FromArgb(255, 255, 0, 255))
pb.Image = Nothing
pb.BackColor = Color.FromArgb(100, Color.Yellow)
Next