1个回答
展开全部
首先,在部件里添加一个microsoft common dialog control 6.0
再加入picture控件,按钮控件
然后写入如下代码
Private Sub Command1_Click()
On Error GoTo err
CommonDialog1.Filter = "bmp文件(*.bmp)|*.bmp|所有文件(*.*)|*.*"
CommonDialog1.CancelError = True
CommonDialog1.ShowOpen
Picture1.Picture = LoadPicture(CommonDialog1.FileName)
Picture1.PaintPicture Picture1.Picture, 0, 0, Picture1.Width, Picture1.Height
Exit Sub
err:
MsgBox "未选择文件"
End Sub
再加入picture控件,按钮控件
然后写入如下代码
Private Sub Command1_Click()
On Error GoTo err
CommonDialog1.Filter = "bmp文件(*.bmp)|*.bmp|所有文件(*.*)|*.*"
CommonDialog1.CancelError = True
CommonDialog1.ShowOpen
Picture1.Picture = LoadPicture(CommonDialog1.FileName)
Picture1.PaintPicture Picture1.Picture, 0, 0, Picture1.Width, Picture1.Height
Exit Sub
err:
MsgBox "未选择文件"
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |