VB6.0中Picturebox控件使用loadpicture老说未找到方法或数据成员。代码还是按照书上来的·····
代码如下:PrivateSubForm_Load()Picture1.Picture=LoadPicture("C:\MyPictures\A.jpg")Picture2...
代码如下:
Private Sub Form_Load()
Picture1.Picture = LoadPicture("C:\My Pictures\A.jpg")
Picture2.Picture = LoadPicture("C:\My Pictures\B.jpg")
End Sub
Private Sub Form_Click()
Form1.Picture = Picture1.Picture
Picture1.Picture = Picture2.Picture
Picture2.Picture = Picture1.Picture
Form1.Picture = LoadPicture()
End Sub
窗体上只有两个picturebox的控件 并且将其中from改为from1运行之后 没有图片显示·· 展开
Private Sub Form_Load()
Picture1.Picture = LoadPicture("C:\My Pictures\A.jpg")
Picture2.Picture = LoadPicture("C:\My Pictures\B.jpg")
End Sub
Private Sub Form_Click()
Form1.Picture = Picture1.Picture
Picture1.Picture = Picture2.Picture
Picture2.Picture = Picture1.Picture
Form1.Picture = LoadPicture()
End Sub
窗体上只有两个picturebox的控件 并且将其中from改为from1运行之后 没有图片显示·· 展开
3个回答
展开全部
代码是没有问题 测试有效 估计是你添加错误的控件 将以下内容复制到记事本 另存为1.frm窗体文件后打开 试试 还有别忘了 图片地址要写正确
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture2
Height = 735
Left = 1920
ScaleHeight = 675
ScaleWidth = 1875
TabIndex = 1
Top = 1920
Width = 1935
End
Begin VB.PictureBox Picture1
Height = 975
Left = 1080
ScaleHeight = 915
ScaleWidth = 2475
TabIndex = 0
Top = 360
Width = 2535
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Picture1.Picture = LoadPicture("C:\My Pictures\A.jpg")
Picture2.Picture = LoadPicture("C:\My Pictures\B.jpg")
End Sub
Private Sub Form_Click()
Form1.Picture = Picture1.Picture
Picture1.Picture = Picture2.Picture
Picture2.Picture = Picture1.Picture
Form1.Picture = LoadPicture()
End Sub
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture2
Height = 735
Left = 1920
ScaleHeight = 675
ScaleWidth = 1875
TabIndex = 1
Top = 1920
Width = 1935
End
Begin VB.PictureBox Picture1
Height = 975
Left = 1080
ScaleHeight = 915
ScaleWidth = 2475
TabIndex = 0
Top = 360
Width = 2535
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Picture1.Picture = LoadPicture("C:\My Pictures\A.jpg")
Picture2.Picture = LoadPicture("C:\My Pictures\B.jpg")
End Sub
Private Sub Form_Click()
Form1.Picture = Picture1.Picture
Picture1.Picture = Picture2.Picture
Picture2.Picture = Picture1.Picture
Form1.Picture = LoadPicture()
End Sub
展开全部
检查下两个图片在不在,控件的使用是没问题。
formclick事件你是想实现什么效果,是两个图片交换吗?
你的代码实现不了,改成:
Form1.Picture = Picture1.Picture
Picture1.Picture = Picture2.Picture
Picture2.Picture = Form1.Picture
Form1.Picture = LoadPicture()
这样才可以,都则picture1和picture2总是相同的图片
formclick事件你是想实现什么效果,是两个图片交换吗?
你的代码实现不了,改成:
Form1.Picture = Picture1.Picture
Picture1.Picture = Picture2.Picture
Picture2.Picture = Form1.Picture
Form1.Picture = LoadPicture()
这样才可以,都则picture1和picture2总是相同的图片
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
从语法上说没问题
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询