for i=0 to 3
Set lblObj = Controls.Add("VB.textbox", "Ll" & i)
With lblObj
.Visible = True
.Width = 2000
.Height = 500
.Top = 500 + i * 2000 + 2000 + 50
.Left = 500 + i * 2000
.Caption = "字符串" & i
.Font = "宋体"
.FontSize = 20
.Alignment = 2
.ForeColor = &HC00000
End With
next
Set lblObj = Controls.Add("VB.textbox", "Ll" & i)
With lblObj
.Visible = True
.Width = 2000
.Height = 500
.Top = 500 + i * 2000 + 2000 + 50
.Left = 500 + i * 2000
.Caption = "字符串" & i
.Font = "宋体"
.FontSize = 20
.Alignment = 2
.ForeColor = &HC00000
End With
next
Option Explicit
Private WithEvents imageObj As Image
Private WithEvents lblObj As Label
Private Sub cmdDisplay_Click()
Dim i As Integer
For i = 0 To 2
Set imageObj = Controls.Add("VB.Image", "Image" & i)
With imageObj
.Visible = True
.Width = 2000
.Height = 2000
.Top = 500 + i * 2000
.Left = 500 + i * 2000
.BorderStyle = 1
.Stretch = True
.Picture = LoadPicture(App.Path + "\Image_" & i & ".jpg")
End With
Set lblObj = Controls.Add("VB.Label", "Label" & i)
With lblObj
.Visible = True
.Width = 2000
.Height = 500
.Top = 500 + i * 2000 + 2000 + 50
.Left = 500 + i * 2000
.Caption = "图片" & i
.Font = "宋体"
.FontSize = 20
.Alignment = 2
.ForeColor = &HC00000
End With
Next
End Sub
Private Sub Form_Load()
Me.Width = 7000
Me.Height = 7500
Me.Top = 50
Me.Left = 1000
End Sub
谢谢boybluesky(boybluesky) 怎么给分?