找传奇、传世资源到传世资源站!

自动消失对话框

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

弹出一个对话框 一定时间后 自动消失.
from clipboard调 用:  AutoClosingMessageBox.Show(Now.ToString, "FFFFFFFFFFFFFFFFFF", 3000)

部分:类代码:Imports System.Windows.Forms
Imports System
Public Class AutoClosingMessageBox
    Private _timeoutTimer As System.Threading.Timer
    Private _caption As String
    Private Sub New(ByVal text As String, ByVal caption As String, ByVal timeout As Integer)
        _caption = caption
        _timeoutTimer = New System.Threading.Timer(AddressOf OnTimerElapsed, Nothing, _
                                                   timeout, System.Threading.Timeout.Infinite)
        MessageBox.Show(text, caption)
    End Sub
    Public Shared Sub Show(ByVal text As String, ByVal caption As String, ByVal timeout As Integer)
        Dim MsgSow As AutoClosingMessageBox = New AutoClosingMessageBox(text, caption, timeout)
    End Sub
    Private Sub OnTimerElapsed(ByVal state As Object)
        Dim mbWnd As IntPtr = FindWindow(Nothing, _caption)
        If mbWnd <> IntPtr.Zero Then
            SendMessage(mbWnd, WM_CLOSE, IntPtr.Zero, IntPtr.Zero)
        End If
        _timeoutTimer.Dispose()
    End Sub

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复