有一个笨办法:
把标签放在frame中,再加个timer,然后来控制标签的位置就行了(左右移)
把标签放在frame中,再加个timer,然后来控制标签的位置就行了(左右移)
解决方案 »
- 在创建ACTIVE DLL 后自动生成一个类模块Class
- 我的机器上装的是office2003,程序打包后,如果客户机是office2000,我的程序中导excel功能可以正常用吗?
- 各位大侠怎样枚举串口?我电脑的串口是:com1 com2 com3 com6(后两个usb转换的),但用RegEnumValue(hKey, Cnt, sSave, 255, 0, ByVal 0&,
- 一个时间转换的问题
- vb
- 请教用VB安装SQL SERVER的数据库的问题
- 求教关于相对路径的问题
- VB怎样装MSDN呀?还需另买盘吗?
- 能否介绍几个国内和国外代收注册费的网站(要求信誉好)?
- 有没有办法获得vb的数组的地址指针?
- 100分!有关数据库的连接ado,在线等待
- 使用vb,如何从SQL Server 的储存过程中获取返回值进行判断
下次
lable.caption="231"
下次
lable.caption="312"
将timer的interval 设为1000
在timer事件中加入:
label1.left=label1.left-100 '数字可任意给
最好加一个frame,并将label标签加入frame中
if label1.left+label1.width<frame.left then
label1.left=frame.left+frame.width
end if
Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hDC As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Private Declare Function GetTickCount Lib "kernel32" () As Long
Const DT_BOTTOM As Long = &H8
Const DT_CALCRECT As Long = &H400
Const DT_CENTER As Long = &H1
Const DT_EXPANDTABS As Long = &H40
Const DT_EXTERNALLEADING As Long = &H200
Const DT_LEFT As Long = &H0
Const DT_NOCLIP As Long = &H100
Const DT_NOPREFIX As Long = &H800
Const DT_RIGHT As Long = &H2
Const DT_SINGLELINE As Long = &H20
Const DT_TABSTOP As Long = &H80
Const DT_TOP As Long = &H0
Const DT_VCENTER As Long = &H4
Const DT_WORDBREAK As Long = &H10Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type'要移动的字
Const ScrollText As String = "1234567890" & vbCrLf & vbCrLf & _
"abcdefghij" & vbCrLf & vbCrLf & _
"ABCDEFGHIJ"
Dim EndingFlag As Boolean
--------------------------------------------------------
Private Sub Form_Activate()
RunMain
End Sub
--------------------------------------------------------
Private Sub RunMain()
Dim LastFrameTime As Long
Const IntervalTime As Long = 40
Dim rt As Long
Dim DrawingRect As RECT
Dim UpperX As Long, UpperY As Long 'Upper left point of drawing rect
Dim RectHeight As Long
Me.Refreshconstant
rt = DrawText(picScroll.hDC, ScrollText, -1, DrawingRect, DT_CALCRECT)If rt = 0 Then 'err
MsgBox "Error scrolling text", vbExclamation
EndingFlag = True
Else
DrawingRect.Top = picScroll.ScaleHeight
DrawingRect.Left = 0
DrawingRect.Right = picScroll.ScaleWidth
'Store the height of The rect
RectHeight = DrawingRect.Bottom
DrawingRect.Bottom = DrawingRect.Bottom + picScroll.ScaleHeight
End If
Do While Not EndingFlag
If GetTickCount() - LastFrameTime > IntervalTime Then
picScroll.Cls
DrawText picScroll.hDC, ScrollText, -1, DrawingRect, DT_CENTER Or DT_WORDBREAK
'update the coordinates of the rectangle
DrawingRect.Top = DrawingRect.Top - 1
DrawingRect.Bottom = DrawingRect.Bottom - 1
'control the scolling and reset if it goes out of bounds
If DrawingRect.Top < -(RectHeight) Then 'time to reset
DrawingRect.Top = picScroll.ScaleHeight
DrawingRect.Bottom = RectHeight + picScroll.ScaleHeight
End If
picScroll.Refresh
LastFrameTime = GetTickCount()
End If
DoEvents
LoopUnload MeEnd Sub