Dim X As New StdPicture
Set X = LoadPicture("c:\windows\circles.bmp")
Set Picture1.Picture = X
’你自己 对 picture 的处理
’完毕后:Set X = Picture1.Picture 不知 你是否 是这个意思。
你怎么不贴 出代码呀?
Set X = LoadPicture("c:\windows\circles.bmp")
Set Picture1.Picture = X
’你自己 对 picture 的处理
’完毕后:Set X = Picture1.Picture 不知 你是否 是这个意思。
你怎么不贴 出代码呀?
dim x as new stdpicture
set x = loadpicture("c:\windows\circles.bmp")
'******************************************************
'* NOTE:这里是对x的一系列处理(我就想知道这里怎么做?)
'******************************************************
debug.print x.width
debug.print x.height
结果是x对象中图片的大小是我处理后的大小。
大概就酱子。
分不够还可以加,搞定立刻给分。
dim x as new stdpicture
set x = loadpicture("c:\windows\circles.bmp")
'******************************************************
'* NOTE:这里是对x的一系列处理(我就想知道这里怎么做?)
'******************************************************
debug.print x.width
debug.print x.height
结果是x对象中图片的大小是我处理后的大小。
大概就酱子。
分不够还可以加,搞定立刻给分。
一般是用 PaintPicture 方法 或 api 函数 StretchBlt() 进行 此 功能。关于 PaintPicture ,它的语法 如下:object.PaintPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode
关于 StretchBlt , 它的声明 如下:Declare Function StretchBlt Lib "gdi32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal hSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
你试试 :Dim X As New StdPicture
Set X = LoadPicture("c:\windows\circles.bmp")
X.Width = Picture.Width
X.Height = Picture.HeightSet Picture1.Picture = X
X.Height = Picture.Height
这样不行
你看,我使用stdPicture的目的是作为picture的载体,如果不是用stdPicture对象还有什么可以装载picture?(请不要使用控件,因为这是在一个class文件中)
=========================================
Handle Property -------------(1)
Height, Width Properties
Type Property (Picture)
hPal Property ------------- (2)(1) 是 容器的 句柄, (2) 是 图片的 句柄。
你 可以 试着 把 这两个 句柄 传给 API 的 StretchBlt 函数。
还是 用StretchBlt 缩放 处理。
我 在网吧,没 vb , 只有 你自己试试了。这 只是我的 思路, 谨供参考 ! :)
是这样的,stdPicture实现的是IPictureDisp接口,据我所知VB的所有图片载体都实现了这个接口。"Handle Property"返回的是一个HBITMAP句柄,可以用它来操作stdPicture中的图片。hPal是ICON文件的调色版句柄。
我就是想问一下如何用API来操作这个HBITMAP句柄,以便完成缩放图片的工作,而且要求是操作完毕,stdPicture仍然是图片的载体。