Public Class Form1
创新互联建站专业为企业提供资源网站建设、资源做网站、资源网站设计、资源网站制作等企业网站建设、网页设计与制作、资源企业网站模板建站服务,十余年资源做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
Dim pArray As New ArrayList()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i = 1 To 7 '7个picturebox变数组
Dim pic As New PictureBox()
pic.Image = Image.FromFile(Application.StartupPath "\image\rred.jpg")
pArray.Add(pic)
Next '改变第二个背景图片
Me.BackgroundImage = CType(pArray(1), PictureBox).Image
'pArray(1).BackgroundImage = Image.FromFile(Application.StartupPath "\image\rred.jpg")
End Sub
End Class
用一个全局变量保存这个1.jpg,如变量a,你按按钮2时,可以简单的在a中插入一个"A",如a.SubString(0, a.Length-4) "A" a.SubString(a.Length-4),这样就能把例如"C:/Images/1.jpg"变成"C:/Images/1A.jpg"
我的做法是先写入一个图片变量,然后再写入到容器上。容器设置双缓冲
还有你说的控件必须透明不太明白,可以直接在容器上绘图,不需要控件,图片的透明度可以用RGBA色的A值(透明度)来控制
我这个也是实时翻滚刷新的,不会闪!
REM 假设存在Image类型变量img
Dim bmp As Bitmap = CType(img, Bitmap) '先将Image类型强制转换为Bitmap类型
bmp.Save("C:\1.png", System.Drawing.Imaging.ImageFormat.Png) '以PNG格式存储到C:\1.png
Dim curSqlstr As String = "INSERT INTO Picture(picture_id, picture_area)" _
"VALUES('" (i + 1).ToString() "','@picture_area ')"
你看这句中的,'@picture_area ')",多个单引号了,被当成VARCHAR处理了.去了单引号才是变量.
Public Class Form1
Private TPS As Integer
Private TPPath() As String '定义不确定元素个数组,及动态数组
Private Sub LoadPhoto()
'将图片路径及图片名加载到数组
Dim JS As Integer '计数用
For Each foundFile As String In My.Computer.FileSystem.GetFiles(CurDir() "\职员图片")
TPS = TPS + 1 '将图片数存入变量中
Next
ReDim TPPath(TPS - 1) '确定数组大小
For Each FoundFile As String In My.Computer.FileSystem.GetFiles(CurDir() "\职员图片")
'将图片路径存入数组
TPPath(JS) = FoundFile
JS = JS + 1
Next
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LoadPhoto()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = TPPath.Length '获取数组大小
Label1.Text = TPPath(1) '获取数组中第2个元素的值
End Sub