VB编程:怎么使图像在移动中缩放?

这里有图像(是鸟)在循环飞行的源程序,怎么修改才能使其在飞行过程中由远及近和由近及远地缩放呢?谢谢。OptionExplicitDimNumber%DimIsPlayin... 这里有图像(是鸟)在循环飞行的源程序,怎么修改才能使其在飞行过程中由远及近和由近及远地缩放呢?谢谢。
Option Explicit
Dim Number%
Dim IsPlaying As Boolean
Dim IncX%, IncY%
Private Sub Form_Load()
IsPlaying = False
Image1.ToolTipText = "动画开始"
Number% = 1
IncX% = 100
IncY% = 100
End Sub
Private Sub Image1_Click()
If IsPlaying Then
IsPlaying = False
Timer1.Enabled = IsPlaying
Image1.ToolTipText = "动画开始"
Else
IsPlaying = True
Timer1.Enabled = IsPlaying
Image1.ToolTipText = "动画停止"
End If
End Sub
Private Sub Timer1_Timer()
Number% = Number% + 1 '¶¯»­ÏÂÒ»Ö¡
If Number% > 5 Then
Number% = 1
End If
Image1.Picture = LoadPicture(App.Path & "\bird" & Number% & ".jpg")

Image1.Move Image1.Left + IncX%, Image1.Top + IncY%
If Image1.Left + Image1.Width >= Form1.Width Then
Image1.Move Form1.Width - Image1.Width, Image1.Top
IncX% = -IncX%
ElseIf Image1.Top + Image1.Height > Form1.Height Then
Image1.Move Image1.Left, Form1.Height - Image1.Height
IncY% = -IncY%
ElseIf Image1.Left <= 0 Then
Image1.Move 0, Image1.Top
IncX% = -IncX%
ElseIf Image1.Top <= 0 Then
IncY% = -IncY%
End If
End Sub
展开
 我来答
支竹青於鸾
2019-12-31
知道答主
回答量:0
采纳率:0%
帮助的人:0
展开全部
我调试成功,没有用MOve可以吗?因为那样比较繁琐!
Option
Explicit
Dim
IsPlaying
As
Boolean
Private
Sub
Form_Load()
Image1.Left
=
100
'初始化鸟的位置
Image1.Top
=
6200
End
Sub
Private
Sub
Image1_Click()
Timer1.Enabled
=
Not
Timer1.Enabled
'取反
End
Sub
Private
Sub
Timer1_Timer()
If
Image1.Left
<=
Me.Width
*
0.5
Then
Image1.Left
=
Image1.Left
+
100‘向右移动
Image1.Top
=
Image1.Top
-
100‘向上移动
Image1.Width
=
Image1.Width
*
0.95
'每次缩小95%
Image1.Height
=
Image1.Height
*
0.95
Else
Image1.Left
=
Image1.Left
+
100’向右移动
Image1.Top
=
Image1.Top
+
100‘响下移动
Image1.Width
=
Image1.Width
/
0.95
'放大
Image1.Height
=
Image1.Height
/
0.95
End
If
If
Image1.Left
>=
me.width*0.9
Then'可以自己更改
Image1.Left
=
100
'初始化位置
Image1.Top
=
6200
End
If
End
Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
后振英霍申
2019-06-05
知道答主
回答量:0
采纳率:0%
帮助的人:0
展开全部
添加一个label控件
'窗体代码
private
downx
as
long
private
downy
as
long
private
xx
as
long
private
yy
as
long
private
mousedown
as
boolean
private
sub
label1_mousedown(button
as
integer,
shift
as
integer,
x
as
single,
y
as
single)
downx
=
x
downy
=
y
mousedown
=
true
end
sub
private
sub
label1_mousemove(button
as
integer,
shift
as
integer,
x
as
single,
y
as
single)
xx
=
x
yy
=
y
if
mousedown
=
true
then
me.move
me.left
+
(xx
-
downx),
me.top
+
(yy
-
downy)
end
sub
private
sub
label1_mouseup(button
as
integer,
shift
as
integer,
x
as
single,
y
as
single)
mousedown
=
false
end
sub
这样就行了!!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
wjbmbl
2007-05-21
知道答主
回答量:0
采纳率:0%
帮助的人:0
展开全部
我调试成功,没有用MOve可以吗?因为那样比较繁琐!
Option Explicit
Dim IsPlaying As Boolean

Private Sub Form_Load()
Image1.Left = 100 '初始化鸟的位置
Image1.Top = 6200
End Sub

Private Sub Image1_Click()
Timer1.Enabled = Not Timer1.Enabled '取反
End Sub

Private Sub Timer1_Timer()
If Image1.Left <= Me.Width * 0.5 Then
Image1.Left = Image1.Left + 100‘向右移动
Image1.Top = Image1.Top - 100‘向上移动
Image1.Width = Image1.Width * 0.95 '每次缩小95%
Image1.Height = Image1.Height * 0.95
Else
Image1.Left = Image1.Left + 100’向右移动
Image1.Top = Image1.Top + 100‘响下移动
Image1.Width = Image1.Width / 0.95 '放大
Image1.Height = Image1.Height / 0.95
End If
If Image1.Left >= me.width*0.9 Then'可以自己更改
Image1.Left = 100 '初始化位置
Image1.Top = 6200
End If
End Sub
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
?>

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式