VB特效

1、Private   Declare   Function   AnimateWindow   Lib   "user32"   (ByVal   hwnd   As   Long,   ByVal  dwTime   As   Long,   ByVal   dwFlags   As   Long)   As   Long 

The AnimateWindow function enables you to produce special effects when showing or hiding windows. There are four types of animation: roll, slide, collapse or expand, and alpha-blended fade.

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
基于VB的文字动画特效代码Private Sub TextEffect( _ ByVal sText As String, _ ByVal lX As Long, ByVal lY As Long, _ Optional ByVal bLoop As Boolean = False, _ Optional ByVal lStartSpacing As Long = 128, _ Optional ByVal lEndSpacing As Long = -1, _ Optional ByVal oColor As OLE_COLOR = vbWindowText _ ) Dim i As Long Dim x As Long Dim lLen As Long Dim lHDC As Long Dim hBrush As Long '定义各种变量 Static tR As RECT Dim iDir As Long Dim bNotFirstTime As Boolean Dim lTime As Long Dim lIter As Long Dim bSlowDown As Boolean Dim lCOlor As Long Dim bDoIt As Boolean iDir = -1 i = lStartSpacing '为变量赋值 tR.left = lX: tR.tOp = lY: tR.Right = lX: tR.Bottom = lY OleTranslateColor oColor, 0, lCOlor hBrush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)) lLen = Len(sText) lHDC = Me.hdc SetTextColor lHDC, lCOlor '设置文字颜色 bDoIt = True Do While m_bDoEffect And bDoIt lTime = timeGetTime If (i < -3) And Not (bLoop) And Not (bSlowDown) Then bSlowDown = True iDir = 1 lIter = (i + 4) End If If (i > 128) Then iDir = -1 If Not (bLoop) And iDir = 1 Then If (i = lEndSpacing) Then bDoIt = False Else lIter = lIter - 1 If (lIter <= 0) Then i = i + iDir lIter = (i + 4) End If End If Else i = i + iDir End If FillRect lHDC, tR, hBrush '调用FillRect函数 x = 32 - (i * lLen) SetTextCharacterExtra lHDC, i DrawText lHDC, sText, lLen, tR, DT_CALCRECT '调用API函数DrawText tR.Right = tR.Right + 4 If (tR.Right > Me.ScaleWidth \ Screen.TwipsPerPixelX) Then tR.Right = Me.ScaleWidth \ Screen.TwipsPerPixelX DrawText lHDC, sText, lLen, tR, DT_LEFT Me.Refresh '窗体刷新 Do DoEvents '后台运行 Loop While (timeGetTime - lTime) < 20 Loop DeleteObject hBrush End Sub
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值