VB如何在程序运行中添加图片框

来源:百度知道 编辑:UC知道 时间:2024/05/18 01:37:09
要求:
在form1中只有一个command1
当程序运行.
点击command1,弹中Inputbox(输入的内容是新建的图片框的name属性)
那么新建了的图片框将在form1的0,0出现(大小自动)
谢谢

Private Sub Command1_Click()
Dim i As Long
Dim pic As PictureBox
Dim pname As String
pname = InputBox("输入图片框名称")
Set pic = Controls.Add("VB.picturebox", pname)
pic.Move 0, 0, Me.Width - 1500, Me.Height - 200
pic.Visible = True
pic.AutoSize = True '自动适应图片大小尺寸
End Sub

...