vb如何用API缩放图片???

发布网友 发布时间:2022-04-24 14:03

我来回答

2个回答

热心网友 时间:2022-05-03 01:43

何必劳烦API?用VB自带函数便可。建Picture1.
代码如下。
===============
Private
Sub
Form_Click()
Picture1.PaintPicture
Picture,
0,
0,
Picture.Width
/
2,
Picture.Height
/
2
End
Sub
Private
Sub
Form_Load()
Picture
=
LoadPicture(Environ("windir")
&
"\winnt256.bmp")
End
Sub
===============
当然用API也未尝不可,函数是StretchBlt。

热心网友 时间:2022-05-03 03:01

没听说过在image中旋转图片的(它连个hdc都没有),一般都是在picturebox里。具体的api可以用plgblt,它是专门实现图像旋转的,不过就是会出现锯齿,但是对你要求的90度,180度和270度就不会出现锯齿。这是我写的旋转函数:function
myrotation(byval
deshdc
as
long,
byval
srchdc
as
long,
byval
desx
as
long,
byval
desy
as
long,
byval
nwidth
as
long,
byval
nheight
as
long,
byval
angle
as
single)
as
long
dim
pi
as
double
pi
=
3.1415926
dim
lppoint(1
to
3)
as
pointapi
dim
rad
as
double
rad
=
angle
*
pi
/
180
lppoint(3).x
=
desx
lppoint(3).y
=
desx
lppoint(1).x
=
lppoint(3).x
+
nheight
*
sin(rad)
lppoint(1).y
=
lppoint(3).y
-
nheight
*
cos(rad)
lppoint(2).x
=
lppoint(1).x
+
nwidth
*
cos(rad)
lppoint(2).y
=
lppoint(1).y
+
nwidth
*
sin(rad)
plgblt
deshdc,
lppoint(1),
srchdc,
0,
0,
nwidth,
nheight,
0,
0,
0
end
function

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com