VB题目:要求单击“交换”按钮,每隔一秒钟两幅图片交换一次,单击“闪烁”按钮,两幅
2个回答
展开全部
添加两个图片框 name属性 写为p1 p2
添加两个按钮 用默认名字
然后粘贴以下代码
Private WithEvents t1 As Timer
Private WithEvents t2 As Timer
Private Sub Form_Load()
Set t1 = Me.Controls.Add("VB.Timer", "t1")
t1.Interval = 1000
t1 = False
Set t2 = Me.Controls.Add("VB.Timer", "t2")
t2.Interval = 1000
t2 = False
End Sub
Private Sub Command1_Click()
t1 = True
t2 = False
End Sub
Private Sub Command2_Click()
t1 = False
t2 = True
End Sub
Private Sub t1_timer()
Clipboard.SetData p1.Picture
p1.Picture = p2.Picture
p2.Picture = Clipboard.GetData
Clipboard.Clear
End Sub
Private Sub t2_timer()
p1.Visible = Not p1.Visible
p2.Visible = Not p2.Visible
End Sub
添加两个按钮 用默认名字
然后粘贴以下代码
Private WithEvents t1 As Timer
Private WithEvents t2 As Timer
Private Sub Form_Load()
Set t1 = Me.Controls.Add("VB.Timer", "t1")
t1.Interval = 1000
t1 = False
Set t2 = Me.Controls.Add("VB.Timer", "t2")
t2.Interval = 1000
t2 = False
End Sub
Private Sub Command1_Click()
t1 = True
t2 = False
End Sub
Private Sub Command2_Click()
t1 = False
t2 = True
End Sub
Private Sub t1_timer()
Clipboard.SetData p1.Picture
p1.Picture = p2.Picture
p2.Picture = Clipboard.GetData
Clipboard.Clear
End Sub
Private Sub t2_timer()
p1.Visible = Not p1.Visible
p2.Visible = Not p2.Visible
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询