7,763
社区成员
发帖
与我相关
我的任务
分享
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 4 'Fixed ToolWindow
Caption = "Ysl_Frame_Move"
ClientHeight = 3345
ClientLeft = 45
ClientTop = 315
ClientWidth = 1785
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3345
ScaleWidth = 1785
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox Picture1
BackColor = &H0000FF00&
DrawMode = 10 'Mask Pen
DrawWidth = 3
Height = 375
Left = 0
ScaleHeight = 315
ScaleWidth = 1755
TabIndex = 9
Top = 3000
Width = 1815
End
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 20
Left = 1920
Top = 2280
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 100
Left = 1920
Top = 1800
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "1.frx":0000
Left = 0
List = "1.frx":000D
TabIndex = 4
Text = "选择显示的颜色"
Top = 2760
Width = 1815
End
Begin VB.Frame Frame1
Height = 1695
Left = 0
TabIndex = 0
Top = 0
Width = 7335
Begin VB.Label Label1
BackColor = &H0000FFFF&
Caption = "Label1"
Height = 1455
Index = 4
Left = 6720
TabIndex = 10
Top = 240
Width = 615
End
Begin VB.Label Label1
BackColor = &H000000FF&
Caption = "Label1"
Height = 1455
Index = 3
Left = 5040
TabIndex = 5
Top = 240
Width = 1695
End
Begin VB.Label Label1
BackColor = &H00FF0000&
Caption = "Label1"
Height = 1455
Index = 2
Left = 3360
TabIndex = 3
Top = 240
Width = 1695
End
Begin VB.Label Label1
BackColor = &H0000FFFF&
Caption = "Label1"
Height = 1455
Index = 1
Left = 1680
TabIndex = 2
Top = 240
Width = 1695
End
Begin VB.Label Label1
BackColor = &H000000FF&
Caption = "Label1"
Height = 1455
Index = 0
Left = 0
TabIndex = 1
Top = 240
Width = 1695
End
End
Begin VB.Line Line1
BorderColor = &H0080FF80&
BorderWidth = 15
X1 = 1800
X2 = 0
Y1 = 2160
Y2 = 2160
End
Begin VB.Label Label4
BackColor = &H00008000&
Caption = "东经 000°00'00.00"""
ForeColor = &H000000FF&
Height = 255
Left = 0
TabIndex = 8
Top = 2520
Width = 1815
End
Begin VB.Label Label3
BackColor = &H00008000&
Caption = " 反 转 于:"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 255
Left = 0
TabIndex = 7
Top = 2280
Width = 1815
End
Begin VB.Label Label2
BackColor = &H0000C000&
Caption = "东经 000°00'00.00"""
ForeColor = &H0000FF00&
Height = 255
Left = 0
TabIndex = 6
Top = 1800
Width = 1815
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a#, T#, TCopy#, L#, Mode#, SubMode As Boolean, Tim#, Longitude#, HH%, MM%, SS!
Const PI = 3.14159265
Dim CenterX#, CenterY#, CenterR#, CurX#, CurY#, CurAnger#, MoveX#, j%
Dim Rvalue%, Gvalue%, Bvalue%
Private Sub Combo1_Click()
Timer2.Enabled = False
If Mode <= Int(100 * Tim) Then
SubMode = True
Else
SubMode = False
End If
Select Case Combo1.ListIndex
Case 0:
T = -(Combo1.ListIndex + 3 * Int((Timer - Int(Timer)) + 0.4)) * Label1(0).Width
If Frame1.Left < -3 * Label1(0).Width + 5 Then T = 0
Case 2:
T = -Combo1.ListIndex * Label1(0).Width
Case 1:
T = -Combo1.ListIndex * Label1(0).Width
End Select
L = Frame1.Left
TCopy = T
a = -Abs((T - L)) / 100
Mode = -1
Timer2.Interval = 2
Timer2.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
CenterX = -180
CenterY = 250
CenterR = 180
CurAnger = 0
i = 0: j = 0
Timer1.Enabled = True
Timer2.Enabled = False
L = Frame1.Left
T = -3 * Label1(0).Width
If L < T + 5 Then T = 0
a = -Abs((T - L)) / 100
Mode = 0
Timer2.Enabled = True
End Sub
Private Sub Timer1_Timer()
j = j + 1
If j < 50 Then
If j > 25 Then Picture1.BackColor = RGB(Rvalue, 255 - j * 5 * Rnd((Timer - Int(Timer))), 5 * j * Rnd((Timer - Int(Timer))))
Rvalue = j * 5
ElseIf j < 100 Then
If j > 75 Then Picture1.BackColor = RGB(5 * (j - 50) * Rnd((Timer - Int(Timer))), Gvalue, 255 - 5 * (j - 50) * Rnd((Timer - Int(Timer))))
Gvalue = (j - 50) * 5
ElseIf j < 150 Then
If j > 125 Then Picture1.BackColor = RGB(255 - (j - 100) * 5 * Rnd((Timer - Int(Timer))), 5 * (j - 100) * Rnd((Timer - Int(Timer))), Bvalue)
Bvalue = (j - 100) * 5
Else
Picture1.DrawMode = Int(16 * (Timer - Int(Timer)) + 1)
j = 0
End If
Picture1.DrawWidth = Int(40 * (Timer - Int(Timer)) + 1)
CurAnger = CurAnger + Rnd((Timer - Int(Timer))) / 50
If CurAnger >= 0.7 * PI Then
CurY = CenterR * Sin(CurAnger)
MoveX = CenterX + CenterR
CurAnger = 0
End If
CurY = CenterR * Sin(CurAnger) * Rnd((Timer - Int(Timer)))
MoveX = MoveX + 20 * Rnd((Timer - Int(Timer)))
Picture1.PSet (MoveX, CenterY - CurY), RGB(Rvalue, Gvalue, Bvalue)
End Sub
'Private Sub Timer1_Timer()
' If Frame1.Left = T Then Timer1.Enabled = False
'L = L + a
'Frame1.Move L
'End Sub
Private Sub Timer2_Timer()
If Mode < 0 Then
If TCopy - 5 <= Frame1.Left And Frame1.Left <= TCopy + 5 Then
Mode = Mode + 1 / 200
Else
T = -3 * Label1(0).Width
Select Case SubMode
Case True
L = L + a
If Frame1.Left < T Then L = 0
Frame1.Move L
Case False
L = L - a
If Frame1.Left > 0 Then
Frame1.Left = T
L = Frame1.Left
End If
Frame1.Move L
End Select
End If
If Mode >= 0 Then
Timer2.Enabled = False
Timer2.Interval = 20
Form_Load
End If
Else
If Mode = 0 Then
Tim = Timer
Tim = Format$((Tim - Int(Tim)), "0.########")
End If
If Mode <= Int(100 * Tim) Then
If Frame1.Left <= -3 * Label1(0).Width Then
L = 0
Mode = Mode + (Rnd(Timer - Int(Timer)))
End If
L = L + a
Frame1.Move L
Mode = Mode + (Rnd(Timer - Int(Timer)))
If Mode > Int(100 * Tim) Then Label4.Caption = Label2.Caption
Else
If Frame1.Left >= 0 Then
Frame1.Left = -3 * Label1(0).Width
L = Frame1.Left
Mode = Mode + (Rnd(Timer - Int(Timer)))
End If
L = L - a
Frame1.Move L
Mode = Mode + (Rnd(Timer - Int(Timer)))
If Mode >= Int(200 * Tim) Then Mode = 0
End If
End If
If Frame1.Left >= -1.5 * Label1(0).Width Then
Longitude = 180 * Frame1.Left / (-1.5 * Label1(0).Width)
HH = Int(Longitude)
MM = Int((Longitude - HH) * 60)
SS = Format((((Longitude - HH) * 60 - MM) * 60), "00.00")
Label2.Caption = "东经 " & HH & "°" & MM & "'" & SS & """"
ElseIf Frame1.Left >= -3 * Label1(0).Width Then
Longitude = 180 * (Frame1.Left + 1.5 * Label1(0).Width) / (-1.5 * Label1(0).Width)
HH = Int(Longitude)
MM = Int((Longitude - HH) * 60)
SS = Format((((Longitude - HH) * 60 - MM) * 60), "00.00")
Label2.Caption = "西经 " & HH & "°" & MM & "'" & SS & """"
End If
If Mode = 0 Then Label4.Caption = Label2.Caption
End Sub
Private Sub Form_Load()
Label1.Caption = "单行显示动态字符串,如何制作跑马灯的效果"
Timer1.Interval = 1000 '这里是跑马灯的速度
With Label1
.Width = Me.Width '这里是LABEL控件的宽度
.Top = 10 'Me.Height -
.Left = 10
End With
End Sub
Private Sub Timer1_Timer()
Label1.Left = Label1.Left + 100
If Label1.Left > (Form1.Width + Label1.Width) Then
Label1.Left = 0
End If
End Sub
效果不如第一方法好。Option Explicit
'直接F5:)
Private Const lDir As Long = -1 '方向,+1与-1分别为右转与左转
Dim WithEvents Timer1 As Timer
Private Sub Form_Load()
'用代码添加控件并设置控件的初始状态.
'这样方便点,可以直接粘贴+F5:)
With Me.Controls
.Add "VB.Label", "Label1"
.Add "VB.Label", "Label2"
.Add "VB.PictureBox", "Picture1"
.Add "VB.Timer", "Timer2"
Set Timer1 = Me!Timer2
End With
With Me!Label1
.AutoSize = True
.Caption = "<-- 测试测试!@$)(#*%#^*$#@! -->"
.Visible = True
Me!Label2.Visible = True
End With
With Me!Picture1
.Appearance = 0 'Flat
.Move 1000, 1000, Me!Label1.Width, Me!Label1.Height + 30
.Visible = True
End With
With Me!Label1
Set .Container = Me!Picture1
Set Me!Label2.Container = Me!Picture1
.Move 0, 0
Me!Label2.Move .Width, 0, .Width, .Height
Me!Label2.Caption = .Caption
End With
Timer1.Interval = 50
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Static oLab1 As Label, oLab2 As Label
Dim oTmp As Label
If oLab1 Is Nothing Then Set oLab1 = Me!Label1
If oLab2 Is Nothing Then Set oLab2 = Me!Label2
If lDir > 0 Then
If oLab1.Left > oLab1.Width Then
Set oTmp = oLab1
Set oLab1 = oLab2
Set oLab2 = oTmp
End If
Else
If oLab1.Left <= -oLab1.Width Then
Set oTmp = oLab1
Set oLab1 = oLab2
Set oLab2 = oTmp
End If
End If
With oLab1
.Move .Left + 15 * lDir
oLab2.Move .Left + .Width * (-lDir)
Me.Caption = .Left & "," & oLab2.Left
End With
DoEvents
End Sub
Option Explicit
'两个Label,一个PictureBox,一个Timer
'Label1设置文字内容,与Label2一起放到Picture1中去,成为子控件
'Timer1.Interval=20
Private Const lDir As Long = -1 '方向,+1与-1分别为右转与左转
Private Sub Timer1_Timer()
Static oLab1 As Label, oLab2 As Label
Dim oTmp As Label
If oLab1 Is Nothing Then Set oLab1 = Label1
If oLab2 Is Nothing Then Set oLab2 = Label2
If lDir > 0 Then
If oLab1.Left > oLab1.Width Then
Set oTmp = oLab1
Set oLab1 = oLab2
Set oLab2 = oTmp
End If
Else
If oLab1.Left <= -oLab1.Width Then
Set oTmp = oLab1
Set oLab1 = oLab2
Set oLab2 = oTmp
End If
End If
With oLab1
.Move .Left + 15 * lDir
oLab2.Move .Left + .Width * (-lDir)
Me.Caption = .Left & "," & oLab2.Left
End With
DoEvents
End Sub
Option Explicit
Dim arr() As String
Dim n As Long
Private Sub Form_Load()
Dim s As String
Dim i As Long
s = "单行显示动态字符串,如何制作跑马灯的效果..."
n = Len(s)
ReDim arr(1 To n)
For i = 1 To n
arr(i) = Mid(s, i, n - i + 1) & Mid(s, 1, i - 1)
Next
Label1.AutoSize = True
Label1.Caption = s
Timer1.Interval = 200
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Static i As Long
i = i + 1
If i > n Then i = 1
Label1.Caption = arr(i)
End Sub
Option Explicit
Dim strTip As String
Private Sub Form_Load()
strTip = "两只小蜜蜂啊,飞到花丛中,飞啊,分啊"
End Sub
Private Sub Timer1_Timer()
Label1.Caption = Right(strTip, Len(strTip) - 1) & Left(strTip, 1)
strTip = Label1.Caption
End Sub
var my_fmt:TextFormat = new TextFormat();
my_fmt.bold = true;
my_fmt.font = "Arial";
my_fmt.size = 22;
my_fmt.color = 0x0000FF;
var show_txt:TextField =_root.createTextField("show_txt",this.getNextHighestDepth(), 10, 20, 260, 62);
show_txt.setNewTextFormat(my_fmt);
show_txt.text =" 单行显示动态字符串,如何制作跑马灯的效果 ";
var a_itv = setInterval(moveTxt,1000)
function moveTxt():Void {
show_txt.text =show_txt.text.substr(1)+show_txt.text.substr(0,1);
}
Option Explicit
Dim strTip(0 To 19) As String
Dim intP As Integer
Private Sub Form_Load()
strTip(0) = "单行显示动态字符串,如何制作跑马灯的效果"
strTip(1) = "行显示动态字符串,如何制作跑马灯的效果单"
strTip(2) = "显示动态字符串,如何制作跑马灯的效果单行"
strTip(3) = "示动态字符串,如何制作跑马灯的效果单行显"
strTip(4) = "动态字符串,如何制作跑马灯的效果单行显示"
strTip(5) = "态字符串,如何制作跑马灯的效果单行显示动"
strTip(6) = "字符串,如何制作跑马灯的效果单行显示动态"
strTip(7) = "符串,如何制作跑马灯的效果单行显示动态字"
strTip(8) = "串,如何制作跑马灯的效果单行显示动态字符"
strTip(9) = ",如何制作跑马灯的效果单行显示动态字符串"
strTip(10) = "如何制作跑马灯的效果单行显示动态字符串,"
strTip(11) = "何制作跑马灯的效果单行显示动态字符串,如"
strTip(12) = "制作跑马灯的效果单行显示动态字符串,如何"
strTip(13) = "作跑马灯的效果单行显示动态字符串,如何制"
strTip(14) = "跑马灯的效果单行显示动态字符串,如何制作"
strTip(15) = "马灯的效果单行显示动态字符串,如何制作跑"
strTip(16) = "灯的效果单行显示动态字符串,如何制作跑马"
strTip(17) = "的效果单行显示动态字符串,如何制作跑马灯"
strTip(18) = "效果单行显示动态字符串,如何制作跑马灯的"
strTip(19) = "果单行显示动态字符串,如何制作跑马灯的效"
lblShow.Caption = ""
tmrShow.Enabled = True
tmrShow.Interval = 500
intP = 0
End Sub
Private Sub tmrShow_Timer()
lblShow.Caption = strTip(intP)
intP = (intP + 1) Mod 20
End Sub