picbox和动态生成控件大人乱入(qq:10083440,在线等待) 各位大人。小弟请教一个问题。一个窗口上有一个picbox控件,小弟还作了一个可视的用户控件。问题,小弟想动态生成该用户控件,并让该控件在picbox这个容器中显示。请问代码怎么写?小弟跪谢/ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 LoadDynamicControl ("应用名.用户控件")具体显示你试试吧 Dim x As PictureBoxPrivate Sub Command3_Click() Set x = Controls.Add("VB.PictureBox", "pic1", Picture1) x.Visible = TrueEnd Sub 用控件数组再用load()动态载如 给你两种方法参考:Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As LongPrivate WithEvents NewButton As CommandButtonPrivate WithEvents NewPic As PictureBoxPrivate WithEvents NewText As TextBoxPrivate Sub Form_Load() Set NewPic = Controls.Add("VB.PictureBox", "PicNew", Me) NewPic.Move 0, 0, Me.Width / 2, Me.Height / 2 NewPic.Visible = TrueEnd SubPrivate Sub NewPic_Click() Set NewButton = Controls.Add("VB.CommandButton", "cmdNew", Me) NewButton.Visible = True Set NewButton.Container = NewPic NewButton.Move 0, 0, 1000, 1000End SubPrivate Sub NewButton_Click() Set NewText = Controls.Add("VB.TextBox", "txtNew", Me) NewText.Visible = True SetParent NewText.hWnd, NewPic.hWnd NewText.Move NewButton.Width + 1, NewButton.Top, 1000, 1000End Sub 关于程序结构设计及速度的问题 问一个点对点通信软件的问题 关于“命令按钮”的疑问?谢谢指点! 终于可以上网了,呵呵,散分先 VB中如何进行地址操作(在线等待) 怎麼讓我的程序像金山詞霸一樣能在word中有一按鈕幵啟金山詞霸程序,我想讓我的程序那樣嵌入別人寫的程序中,謝謝!! 求助:移动后前一个影像还存在,也就是移动后是一串图形,急!! 昨晚居然梦到巴顿 关于Stop,VB高手请进,100分! 在局域网上用VB6如何用OpenDataBase方式访问只读形式Access数据库 急:关于日期格式的! 如何取驱动器的序列号? 就是每次重格都重新生成的? 因为非IDE和有些老硬盘取不到出厂号!
具体显示你试试吧
Set x = Controls.Add("VB.PictureBox", "pic1", Picture1)
x.Visible = True
End Sub
再用load()动态载如
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As LongPrivate WithEvents NewButton As CommandButton
Private WithEvents NewPic As PictureBox
Private WithEvents NewText As TextBoxPrivate Sub Form_Load()
Set NewPic = Controls.Add("VB.PictureBox", "PicNew", Me)
NewPic.Move 0, 0, Me.Width / 2, Me.Height / 2
NewPic.Visible = True
End SubPrivate Sub NewPic_Click()
Set NewButton = Controls.Add("VB.CommandButton", "cmdNew", Me)
NewButton.Visible = True
Set NewButton.Container = NewPic
NewButton.Move 0, 0, 1000, 1000
End SubPrivate Sub NewButton_Click()
Set NewText = Controls.Add("VB.TextBox", "txtNew", Me)
NewText.Visible = True
SetParent NewText.hWnd, NewPic.hWnd
NewText.Move NewButton.Width + 1, NewButton.Top, 1000, 1000
End Sub