VB 关于PictureBox库?类?的问题
DimpicAsPictureBoxsetpic=LoadPicture(App.Path&"\123.bmp")每次运行的时候,总是不对,老提示一个错误:实时错误:91...
Dim pic As PictureBox
set pic=LoadPicture(App.Path & "\123.bmp")
每次运行的时候,总是不对,老提示一个错误:
实时错误:91
对象变量或with块变量未设置。
什么意思啊,我都已经试了很多的方法了
加上pic=Nothing等
或用dim pic1 as stdpicture
set pic1=LoadPicture(App.Path & "\123.bmp")
pic.picture=pic1
总是不能成功的将pic赋一张图片进去?
请问谁有什么好的办法啊
因为我要用
Private Declare Function AlphaBlend Lib "msimg32.dll" _
(ByVal hdc As Long, _
ByVal lInt As Long, _
ByVal lInt As Long, _
ByVal lInt As Long, _
ByVal lInt As Long, _
ByVal hdc As Long, _
ByVal lInt As Long, _
ByVal lInt As Long, _
ByVal lInt As Long, _
ByVal lInt As Long, _
ByVal BLENDFUNCT As Long) As Long
方法将图片透明处理后显示在窗体上,因为是小游戏不希望用控件,但不是picturebox的话,没有HDC又不能用?
郁闷了
希望有高手能给个方法,谢谢了
我主要目的是想处理一张图片半透明后显示在窗体上,不能使用控件
再次感谢,分不是问题! 展开
set pic=LoadPicture(App.Path & "\123.bmp")
每次运行的时候,总是不对,老提示一个错误:
实时错误:91
对象变量或with块变量未设置。
什么意思啊,我都已经试了很多的方法了
加上pic=Nothing等
或用dim pic1 as stdpicture
set pic1=LoadPicture(App.Path & "\123.bmp")
pic.picture=pic1
总是不能成功的将pic赋一张图片进去?
请问谁有什么好的办法啊
因为我要用
Private Declare Function AlphaBlend Lib "msimg32.dll" _
(ByVal hdc As Long, _
ByVal lInt As Long, _
ByVal lInt As Long, _
ByVal lInt As Long, _
ByVal lInt As Long, _
ByVal hdc As Long, _
ByVal lInt As Long, _
ByVal lInt As Long, _
ByVal lInt As Long, _
ByVal lInt As Long, _
ByVal BLENDFUNCT As Long) As Long
方法将图片透明处理后显示在窗体上,因为是小游戏不希望用控件,但不是picturebox的话,没有HDC又不能用?
郁闷了
希望有高手能给个方法,谢谢了
我主要目的是想处理一张图片半透明后显示在窗体上,不能使用控件
再次感谢,分不是问题! 展开
展开全部
'使用 StdPicture 对象
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Sub Command1_Click()
Dim aPic As StdPicture
Dim hMemDc As Long
Dim holdbmp As Long
Set aPic = LoadPicture(App.Path & "\123.bmp")
hMemDc = CreateCompatibleDC(0)
holdbmp = SelectObject(hMemDc, aPic.Handle)
'AlphaBlend 放在这里
'hMemDc 是 aPic 的 hdc
SelectObject hMemDc, holdbmp
Set aPic = Nothing
End Sub
Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Sub Command1_Click()
Dim aPic As StdPicture
Dim hMemDc As Long
Dim holdbmp As Long
Set aPic = LoadPicture(App.Path & "\123.bmp")
hMemDc = CreateCompatibleDC(0)
holdbmp = SelectObject(hMemDc, aPic.Handle)
'AlphaBlend 放在这里
'hMemDc 是 aPic 的 hdc
SelectObject hMemDc, holdbmp
Set aPic = Nothing
End Sub
展开全部
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
假设你画的PictureBox的名字叫picture1,那么,这样用:
Dim pic As PictureBox
set pic=picture1
pic.picture=LoadPicture(App.Path & "\123.bmp")
Dim pic As PictureBox
set pic=picture1
pic.picture=LoadPicture(App.Path & "\123.bmp")
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
兄台,貌似声明的时候应该是
Dim pic as Picture 不是 Dim pic As PictureBox
Dim pic as Picture 不是 Dim pic As PictureBox
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询