VB的几个趣味程序
?牐牭贝疤灞患せ钍保帜换岽酉峦匣夯荷仙竦缬白帜恍Ч谎蹦慊箍梢愿谋渥帜恢械奈淖郑龆俣取?
#2 界面设计
?牐犜诖疤逯刑砑右桓鯬ictureBox和Timer控件,然后将一个TextBox和滚动条VScrollBox加入到PictureBox中。
?牐牫绦蛉缦拢?
?牐燩rivate Sub Form_Activate()?煟?
?牐燭imer1.Enabled = True
?牐燛nd Sub
?牐燩rivate Sub Form_Load()?煟?
?牐燭imer1.Interval = 35
?牐燰Scroll1.Max = Picture1.Height '将文本框限定在图片框之中滚动
?牐燰Scroll1.Min = 0 - Text1.Height
?牐燰Scroll1.Value = VScroll1.Max
?牐燛nd Sub
?牐燩rivate Sub Text2_LostFocus()?煟?
?牐燭ext1.Text = Text2.Text
?牐燛nd Sub
?牐燩rivate Sub Timer1_Timer()?煟?
?牐營f VScroll1.Value > -?煟═ext1.Height - 20) Then '也可用VScroll1.Value >0
?牐燰Scroll1.Value = VScroll1.Value - 35
?牐燛lse
?牐燰Scroll1.Value = VScroll1.Max
?牐燚oEvents
?牐燛nd If
?牐燭ext1.Top = VScroll1.Value
?牐燭ext1.Visible = True
?牐燚oEvents
?牐燛nd Sub
#1 特殊的退出效果
?牐牭钡セ鞔疤迳系耐顺霭磁ナ保疤宀皇窍褚话闱榭鲆幌戮托对亓耍谴酉峦现鸾ハВ敝皇1晏饫甘保指谋淞诵对胤绞剑即佑彝笾敝寥肯А?
#2 界面设计
?牐犜诖疤逯刑砑右桓鯟ommandButton控件。
?牐牫绦蛉缦拢?
?牐燩rivate Sub Command1_Click()?煟?
?牐燝otoVal = Me.Height / 2
?牐燜or Gointo = 1 To GotoVal
?牐燚oEvents
?牐燤e.Height = Me.Height - 10
?牐營f Me.Height <= 11 Then GoTo horiz
?牐燦ext Gointo
?牐爃oriz??
?牐燤e.Height = 30
?牐燝otoVal = Me.Width / 2
?牐燜or Gointo = 1 To GotoVal
?牐燚oEvents
?牐燤e.Width = Me.Width - 10
?牐營f Me.Width <= 11 Then End
?牐燦ext Gointo
?牐燛nd
?牐燛nd Sub
#1 闪烁的窗体和标签
?牐犝飧龀绦蚴迪至舜疤迳媳昵┑纳了感Ч饪杀挥糜诰娑曰翱蛑校咕嫔了覆恢梗嵝延没ё⒁狻?
#2 界面设计
?牐犜诖疤逯刑砑右桓鯰imer控件,设置Interval=600,一个Label标签。
?牐牫绦蛉缦拢?
?牐燩rivate Sub Timer1_Timer()?煟?
?牐營f Label1.FontSize = 12 Then
?牐燣abel1.ForeColor = &HFF0000 '亮标签
?牐燣abel1.FontSize = 14
?牐燣abel1.FontBold = False
?牐燜orm1.Height = Form1.Height + 100
?牐燜orm1.Width = Form1.Width + 100
?牐燜orm1.Left = Form1.Left - 50
?牐燜orm1.Top = Form1.Top - 50
?牐燛lse
?牐燣abel1.ForeColor = &H800000 '暗标签
?牐燣abel1.FontSize = 12
?牐燣abel1.FontBold = True
?牐燜orm1.Height = Form1.Height - 100
?牐燜orm1.Width = Form1.Width - 100
?牐燜orm1.Left = Form1.Left + 50
?牐燜orm1.Top = Form1.Top + 50
?牐燛nd If
?牐燛nd Sub??