01.
Private
Sub
LoopImageCE()
02.
Dim
filePaths
As
String
() = Directory.GetFiles(
"Nand\\MBApp\\Album"
)
03.
04.
Dim
PictureBox
As
PictureBox() =
New
PictureBox(filePaths.Length - 1) {}
05.
Dim
CheckBox
As
CheckBox() =
New
CheckBox(filePaths.Length - 1) {}
06.
07.
08.
Dim
begin
As
Integer
= 0
09.
Dim
beginChk
As
Integer
= 0
10.
11.
For
i
As
Integer
= 0
To
filePaths.Length - 1
12.
PictureBox1(i) =
New
System.Windows.Forms.PictureBox()
13.
PictureBox(i).BackColor = System.Drawing.Color.FromArgb(
CInt
(
CByte
(128)),
CInt
(
CByte
(192)),
CInt
(
CByte
(255)))
14.
PictureBox(i).Location =
New
System.Drawing.Point(begin, 0)
15.
PictureBox(i).Name =
"pictureBox1"
16.
PictureBox(i).Size =
New
System.Drawing.Size(75, 55)
17.
PictureBox(i).SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
18.
Me
.Controls.Add(PictureBox(i))
19.
begin += 85
20.
21.
CheckBox(i) =
New
System.Windows.Forms.CheckBox()
22.
CheckBox(i).Location =
New
System.Drawing.Point(beginChk, 60)
23.
CheckBox(i).Name =
"checkBox1"
24.
CheckBox(i).Size =
New
System.Drawing.Size(20, 20)
25.
CheckBox(i).TabIndex = 3 + i
26.
Me
.Controls.Add(CheckBox(i))
27.
beginChk += 85
28.
Next
29.
30.
31.
Dim
c
As
Integer
= 0
32.
For
Each
Path
As
String
In
filePaths
33.
Dim
myImage
As
Image =
New
Bitmap(Path)
34.
PictureBox(c).Image = myImage
35.
c += 1
36.
Next
37.
End
Sub