我已经在表单上创建了一个通知栏,并且基本上确切地知道了我需要它...除了,当我放入淡入功能时,任务栏图标不会显示出来。对于我的应用程序,这是必要的,因为显示通知时任务栏图标会闪烁橙色。我已检查过明显的例如:my ShowInTaskbar
property = true,并在应用程序属性中选择了正确的图标。
我想知道是否有人知道为什么会发生这种情况,如果有办法解决这个问题,我可以保持表格的淡入效果。
我已经包含了表单代码。它的第13,20和27-31行激活淡入。
Imports System.Data.SqlClient
Imports system.runtime.interopservices
public class form10
<DllImport("user32.dll", EntryPoint:="FlashWindow")>
Public Shared Function FlashWindow(ByVal hwnd As Integer, ByVal bInvert As Integer) As Integer
End Function
Private Sub Form10_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' sets form to bottom right of page
Me.Location = New Point(Screen.PrimaryScreen.WorkingArea.Width - 381, Screen.PrimaryScreen.WorkingArea.Height - 131)
Me.Opacity = 0.1
With Timer1
.Interval = 300
.Enabled = True
.Start()
End With
Timer2.Start()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
FlashWindow(Me.Handle, 1)
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
If Me.Opacity < 1.0 Then
Me.Opacity = Me.Opacity + 0.1
End If
End Sub
答案 0 :(得分:0)
我通过停止计时器并将此代码添加到Private sub Timer2_Tick
来修复它If Me.Opacity = 1 Then Timer2.Stop() End If
同时取消TopMost
媒体资源并将me.TopMost = True
代码添加到加载子资源中,这完全纠正了我的问题。