VB中的随机图像选择 [英] random image selection in VB

查看:69
本文介绍了VB中的随机图像选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



任何想法如何在vb中随机选择图片/图片请


谢谢

解决方案




任何想法如何在vb中随机选择图片/图片请



你能更具体一点吗? 你选择一张图片究竟是什么意思?给我们一些上下文来使用。


另外,什么版本的VB?


谢谢

使用VB 2005快递版,我正在编写一个程序,点击一个按钮就会显示随机选择的图片(从5开始)。


这是我的编码:

Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理Button1.Click

Dim x(4)As PictureBox

x(0).Equals(PictureBox1.Image)

x(1).Equals(PictureBox2.Image)

x(2).Equals(PictureBox3.Image)

x(3).Equals(PictureBox4.Image)

x(4).Equals(PictureBox5.Image)


Dim randomgenerator As New Random

Dim computerchoice as Integer


computerchoice = randomgenerator.Next(0,5)


到目前为止看似合理 - 那么问题是什么?

Hi
any idea how to randomly select an image/picture in vb please

thanks

解决方案

Hi
any idea how to randomly select an image/picture in vb please

Can you be a bit more specific? What exactly do you mean by "select an image"? Give us some context to work with.

Also, what version of VB?


thanks
Using VB 2005 express Edition, i''m writing a programme where a randomly selected picture (from 5), will be displayed at the click of a button.

Here''s my coding:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x(4) As PictureBox
x(0).Equals(PictureBox1.Image)
x(1).Equals(PictureBox2.Image)
x(2).Equals(PictureBox3.Image)
x(3).Equals(PictureBox4.Image)
x(4).Equals(PictureBox5.Image)


Dim randomgenerator As New Random
Dim computerchoice As Integer

computerchoice = randomgenerator.Next(0, 5)


Seems reasonable so far - so what''s the problem?


这篇关于VB中的随机图像选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆