Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net PictureBox的图像定位_Vb.net_Picturebox - Fatal编程技术网

Vb.net PictureBox的图像定位

Vb.net PictureBox的图像定位,vb.net,picturebox,Vb.net,Picturebox,我的代码遇到了一个问题 我的代码: 导入System.IO 公开课表格1 私有子按钮1\u单击ByVal发送者作为System.Object,ByVal e作为System.EventArgs处理按钮1。单击 将myPics暗显为新目录InfoF:\Documents and Settings\Adam\My Documents\My Pictures dimr作为新的随机变量 Dim i作为整数=r.NextmyPics.GetFiles.Length Dim Pics As FileInfo

我的代码遇到了一个问题

我的代码:

导入System.IO 公开课表格1 私有子按钮1\u单击ByVal发送者作为System.Object,ByVal e作为System.EventArgs处理按钮1。单击 将myPics暗显为新目录InfoF:\Documents and Settings\Adam\My Documents\My Pictures dimr作为新的随机变量 Dim i作为整数=r.NextmyPics.GetFiles.Length Dim Pics As FileInfo=myPics.GetFiles PictureBox1.ImageLocation=Picsi.FullName 端接头 末级 我得到一个错误:

imagelocation不是windows.forms.picturebox的成员

我应该如何解决这个问题?

谷歌:

在此编码中,Ctrl是控件引用,而不是PictureBox。因此,您需要将其转换为PictureBox引用

If TypeOf ctrl Is PictureBox And ctrl.Name = PictureBoxName Then
   Dim MyPictureBox as PictureBox
   MyPictureBox = ctrl

   MyPictureBox.Imagelocation = sFilename
   MyPictureBox.SizeMode = PictureBoxSizeMode.StretchImage
End If