Private Const WS_EX_LAYERED = &H80000 Private Const GWL_EXSTYLE = (-20) Private Const LWA_ALPHA = &H2 Private Const LWA_COLORKEY = &H1Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As LongDim Alpha As Integer '声明变量 Private Sub cmdDL_Click() If Me.Combo1.Text = "" Then MsgBox "请选择登陆用户!", 48, "错误提示" Exit Sub End If Call OpenConn SQL = "select * from 系统用户表 where Czy='" & Me.Combo1.Text & "'" rs.Open SQL, cn, 1, 1 If zhuan(txtPass.Text) = IIf(Trim(IsNull(rs.Fields("pass"))), "", Trim(rs.Fields("pass"))) Then gCzy = rs.Fields("czy") gCzyqx = rs.Fields("czyqx") Call CloseConn MDIfrm.Show Unload Me Else MsgBox "密码错误!", 48, "错误提示" End If End SubPrivate Sub cmdTC_Click() End End SubPrivate Sub Form_Load()Me.Shape1.Top = Me.Top '外边框 Me.Shape1.Left = Me.Left Me.Shape1.Width = Me.ScaleWidth Me.Shape1.Height = Me.ScaleHeight '--------------------------------------------- Dim Ret As Long Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE) Ret = Ret Or WS_EX_LAYERED SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret Timer1.Interval = 20 '-------------------------------------------- Call OpenConn SQL = "select czy from 系统用户表" rs.Open SQL, cn, 1, 1 Do While Not rs.EOF Me.Combo1.AddItem rs!czy rs.MoveNext Loop Call CloseConnCall OpenConn SQL = "select 公司名称 from 公司信息" rs.Open SQL, cn, 1, 1 If rs.RecordCount > 0 Then gGsmc = rs!公司名称 Else gGsmc = "公司信息未知" End If Call CloseConn End SubPrivate Sub Timer1_Timer() Alpha = Alpha + 5 If Alpha > 255 Then Timer1.Enabled = False Exit Sub End If SetLayeredWindowAttributes Me.hWnd, 0, Alpha, LWA_ALPHA End Sub 渐现式窗体,希望你喜欢!
6楼的,要发代码也稍微整理一下啊Private Const WS_EX_LAYERED = &H80000 Private Const GWL_EXSTYLE = (-20) Private Const LWA_ALPHA = &H2 Private Const LWA_COLORKEY = &H1Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As LongDim Alpha As Integer '声明变量Private Sub Form_Load() Dim Ret As Long Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE) Ret = Ret Or WS_EX_LAYERED SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret Timer1.Interval = 20End SubPrivate Sub Timer1_Timer() Alpha = Alpha + 5 If Alpha > 255 Then Timer1.Enabled = False Exit Sub End If SetLayeredWindowAttributes Me.hWnd, 0, Alpha, LWA_ALPHA End Sub
另外可用API函数改变形状……
也可用皮肤控件……
Private Const WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As LongDim Alpha As Integer '声明变量
Private Sub cmdDL_Click()
If Me.Combo1.Text = "" Then
MsgBox "请选择登陆用户!", 48, "错误提示"
Exit Sub
End If
Call OpenConn
SQL = "select * from 系统用户表 where Czy='" & Me.Combo1.Text & "'"
rs.Open SQL, cn, 1, 1
If zhuan(txtPass.Text) = IIf(Trim(IsNull(rs.Fields("pass"))), "", Trim(rs.Fields("pass"))) Then
gCzy = rs.Fields("czy")
gCzyqx = rs.Fields("czyqx")
Call CloseConn
MDIfrm.Show Unload Me
Else
MsgBox "密码错误!", 48, "错误提示"
End If
End SubPrivate Sub cmdTC_Click()
End
End SubPrivate Sub Form_Load()Me.Shape1.Top = Me.Top '外边框
Me.Shape1.Left = Me.Left
Me.Shape1.Width = Me.ScaleWidth
Me.Shape1.Height = Me.ScaleHeight
'---------------------------------------------
Dim Ret As Long
Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
Timer1.Interval = 20
'--------------------------------------------
Call OpenConn
SQL = "select czy from 系统用户表"
rs.Open SQL, cn, 1, 1
Do While Not rs.EOF
Me.Combo1.AddItem rs!czy
rs.MoveNext
Loop
Call CloseConnCall OpenConn
SQL = "select 公司名称 from 公司信息"
rs.Open SQL, cn, 1, 1
If rs.RecordCount > 0 Then
gGsmc = rs!公司名称
Else
gGsmc = "公司信息未知"
End If
Call CloseConn
End SubPrivate Sub Timer1_Timer()
Alpha = Alpha + 5
If Alpha > 255 Then
Timer1.Enabled = False
Exit Sub
End If
SetLayeredWindowAttributes Me.hWnd, 0, Alpha, LWA_ALPHA
End Sub
渐现式窗体,希望你喜欢!
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As LongDim Alpha As Integer '声明变量Private Sub Form_Load()
Dim Ret As Long
Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
Timer1.Interval = 20End SubPrivate Sub Timer1_Timer()
Alpha = Alpha + 5
If Alpha > 255 Then
Timer1.Enabled = False
Exit Sub
End If
SetLayeredWindowAttributes Me.hWnd, 0, Alpha, LWA_ALPHA
End Sub
如果设计的时候有些透明和半透明的技术混合动画效果,
在配合点音乐或音效会更加好。
用好GDI和GDI+使用PNG,配合UpdateLayeredWindow来做透明+半透明+阴影的动画效果
用MCI或DirectShow搞媒体音乐播放,当然,这一切都是要建立在设计比较好的情况下才能
发挥好效果的。说白了,要看你个方面的功力了。