PictureBox1.Location = New Point(100,100)
poker.My.Resources.Resources.0 (0.jpg) '專案內的圖片(必須先行匯入)
Dim newImage As Image = Image.FromFile("D:\pic\0.jpg") '外部磁碟機資料夾的圖片
PictureBox1.Image = newImage
指定圖片位置:PictureBox1.ImageLocation = "D:\pic\10.jpg"
依照參考文獻,先將檔案匯入Resource內。
Dim resourceName As String = poker_index.ToString() '在資源檔裡的檔案編號(索引)
Dim img As Image = CType(My.Resources.ResourceManager.GetObject(resourceName), Image)
PictureBox1.Image = img;
https://slmtsite.blogspot.com/2016/10/c-39-picturebox.html
Randomize()
Dim poker_index As Integer
poker_index = CInt(Int(52 * Rnd() + 1)) '隨機取 1~52
Dim resourceName As String = poker_index.ToString()
Dim img As Image = CType(My.Resources.ResourceManager.GetObject(resourceName), Image)
PictureBox1.Image = img
PictureBox1.Image = Nothing