谢谢1.置顶 我全部都会有地方让使用者最小化的, 呵...到最后再加...2.下面这代码是最后一个代码Tmer1 是淡进与淡出 Timer2是一个PictureBOX上面有那些白字Private Sub Form_Load() On Error Resume Next Me.BorderStyle = 0: Me.Caption = "" Me.Move LearnMain.Left, LearnMain.Top SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3 '设定总在最前 '*********************************************************************** TransColor = vbBlue Me.BackColor = TransColor NowLevel = 0: Fadeio = 1 Call TransParent(Me.hwnd, TransColor, NowLevel) Timer1.Interval = 100: Timer1.Enabled = True '********************************************* Me.Caption = "感谢您的大力支持" Picture1.AutoRedraw = True Timer2.Interval = 10 End SubPrivate Sub Form_Unload(Cancel As Integer) On Error Resume Next Call CleanAll End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error Resume Next If Button <> 0 Then DragKj (Me.hwnd) End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) On Error Resume Next If Button <> 0 Then DragKj (Me.hwnd) End SubPrivate Sub Timer1_Timer() On Error Resume Next If NowLevel >= 0 And NowLevel <= 255 Then Call TransParent(Me.hwnd, TransColor, NowLevel) If Fadeio = 1 Then NowLevel = NowLevel + LVstep If NowLevel >= 255 Then NowLevel = 255 Timer1.Enabled = False Call TransParent(Me.hwnd, TransColor, NowLevel) Picture2.Move Picture2.Left, Picture3.Height Timer2.Enabled = True End If Else NowLevel = NowLevel - LVstep If NowLevel <= 0 Then Timer1.Enabled = False: Unload Me End If End SubPrivate Sub Timer2_Timer() On Error Resume Next Picture2.Top = Picture2.Top - 40 If Picture2.Top <= 300 Then Timer2.Enabled = False: Picture2.Top = 300 LearnMain.WindowState = 1 Call DelayCycle(1500) PlayVoice (VoiceDisk & "再见.wav") Fadeio = 2 Timer1.Enabled = True End If End Sub
我的意思就是在 End 之前,让系统把桌面(整个屏幕)刷新一下。好象有个什么 API ,发个消息什么的。记不清楚了 ,也许你知道这个。应该不是淡入淡出的问题。我也偶尔搞淡入淡出的窗口,从来没遇到过花屏现象。 你那个大窗口淡入淡出没有任何异常,仅仅那个主界面窗口,在我这儿淡入淡出的时候有点问题。
主界面的淡进淡出 因为我这代码将会完全公开 当教材的所以主面我用另个 API (AlphaBlend)我常用来半透明溶合图片应该不会有问题的,Sub ShowTransparency(cSrc As PictureBox, cDest As PictureBox, ByVal nLevel As Byte) On Error Resume Next Dim LrProps As rBlendProps Dim LnBlendPtr As Long cDest.Cls LrProps.tBlendAmount = nLevel CopyMemory LnBlendPtr, LrProps, 4 With cSrc AlphaBlend cDest.hDC, 0, 0, .ScaleWidth, .ScaleHeight, .hDC, 0, 0, .ScaleWidth, .ScaleHeight, LnBlendPtr End With cDest.Refresh End Sub
http://cbm666.com/ppmouse.rar
①退出后,屏幕花屏。似乎启动程序后,直接关闭 与点击‘综合属性’后再关闭,花屏的状态不相同。
启动后直接退出,是把一些区域搞成了‘白屏’。
②最后的‘再见’画面,我想效果应该是从中间出现文字,向上滚动显示吧。
在我这里是“在中间部分出现一行(约5象素高)闪烁的白色点,稍等一下文字全部显示出来”。
③程序退出后,系统托盘中 鼠标特效 的图标没有清除。
这时把鼠标移过去,托盘中那个图标才会消失。这里有一个屏幕截图。 【点这里查看原始大图】
还有,我建议你的软件窗口不要强行置顶。毕竟窗口比较大,一运行你的软件,就会影响别的操作。
至少,你可以让别人选择是否置顶吧!
(这里仅是我的观点,你可以无视:①窗口置顶问题。②不喜欢关闭软件时,无条件询问“是否退出”。)
On Error Resume Next
Me.BorderStyle = 0: Me.Caption = ""
Me.Move LearnMain.Left, LearnMain.Top
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 3 '设定总在最前
'***********************************************************************
TransColor = vbBlue
Me.BackColor = TransColor
NowLevel = 0: Fadeio = 1
Call TransParent(Me.hwnd, TransColor, NowLevel)
Timer1.Interval = 100: Timer1.Enabled = True
'*********************************************
Me.Caption = "感谢您的大力支持"
Picture1.AutoRedraw = True
Timer2.Interval = 10
End SubPrivate Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Call CleanAll
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
If Button <> 0 Then DragKj (Me.hwnd)
End SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
If Button <> 0 Then DragKj (Me.hwnd)
End SubPrivate Sub Timer1_Timer()
On Error Resume Next
If NowLevel >= 0 And NowLevel <= 255 Then Call TransParent(Me.hwnd, TransColor, NowLevel)
If Fadeio = 1 Then
NowLevel = NowLevel + LVstep
If NowLevel >= 255 Then
NowLevel = 255
Timer1.Enabled = False
Call TransParent(Me.hwnd, TransColor, NowLevel)
Picture2.Move Picture2.Left, Picture3.Height
Timer2.Enabled = True
End If
Else
NowLevel = NowLevel - LVstep
If NowLevel <= 0 Then Timer1.Enabled = False: Unload Me
End If
End SubPrivate Sub Timer2_Timer()
On Error Resume Next
Picture2.Top = Picture2.Top - 40
If Picture2.Top <= 300 Then
Timer2.Enabled = False: Picture2.Top = 300
LearnMain.WindowState = 1
Call DelayCycle(1500)
PlayVoice (VoiceDisk & "再见.wav")
Fadeio = 2
Timer1.Enabled = True
End If
End Sub
你那个大窗口淡入淡出没有任何异常,仅仅那个主界面窗口,在我这儿淡入淡出的时候有点问题。
On Error Resume Next
Dim LrProps As rBlendProps
Dim LnBlendPtr As Long
cDest.Cls
LrProps.tBlendAmount = nLevel
CopyMemory LnBlendPtr, LrProps, 4
With cSrc
AlphaBlend cDest.hDC, 0, 0, .ScaleWidth, .ScaleHeight, .hDC, 0, 0, .ScaleWidth, .ScaleHeight, LnBlendPtr
End With
cDest.Refresh
End Sub