⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aboutdialog.vb

📁 一个界面很好的iRadio收音机 一个界面很好的iRadio收音机
💻 VB
📖 第 1 页 / 共 4 页
字号:
                    rk = Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion", False)
                    Return rk.GetValue("RegisteredOwner").ToString
                    rk.Close()

                Case Else
                    Return "Unknown"
            End Select
        Catch ex As NullReferenceException
            Return "Unknown"
        End Try

    End Function

#End Region

#Region " Assembly Information "

    ''' <summary>
    ''' Get Title from AssemblyInfo.cs
    ''' </summary>
    Public ReadOnly Property AssemblyTitle() As String
        Get
            ' Get all Title attributes on this assembly
            Dim attributes() As Object = Assembly.GetExecutingAssembly().GetCustomAttributes(GetType(AssemblyTitleAttribute), False)
            ' If there is at least one Title attribute
            If attributes.Length > 0 Then
                ' Select the first one
                Dim titleAttribute As AssemblyTitleAttribute = CType(attributes(0), AssemblyTitleAttribute)
                ' If it is not an empty string, return it
                If titleAttribute.Title <> "" Then
                    Return titleAttribute.Title
                End If
            End If
            ' If there was no Title attribute, or if the Title attribute was the empty string, return the .exe name
            Return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase)
        End Get
    End Property

    ''' <summary>
    ''' Get Version from AssemblyInfo.cs
    ''' </summary>
    Public ReadOnly Property AssemblyVersion() As String
        Get
            Return Assembly.GetExecutingAssembly().GetName().Version.ToString()
        End Get
    End Property

    ''' <summary>
    ''' Get Description form AssemblyInfo.cs
    ''' </summary>
    Public ReadOnly Property AssemblyDescription() As String
        Get
            ' Get all Description attributes on this assembly
            Dim attributes() As Object = Assembly.GetExecutingAssembly().GetCustomAttributes(GetType(AssemblyDescriptionAttribute), False)
            ' If there aren't any Description attributes, return an empty string
            If attributes.Length = 0 Then
                Return ""
            End If
            ' If there is a Description attribute, return its value
            Return (CType(attributes(0), AssemblyDescriptionAttribute)).Description
        End Get
    End Property

    ''' <summary>
    ''' Get Product Name from AssemblyInfo.cs
    ''' </summary>
    Public ReadOnly Property AssemblyProduct() As String
        Get
            ' Get all Product attributes on this assembly
            Dim attributes() As Object = Assembly.GetExecutingAssembly().GetCustomAttributes(GetType(AssemblyProductAttribute), False)
            ' If there aren't any Product attributes, return an empty string
            If attributes.Length = 0 Then
                Return ""
            End If
            ' If there is a Product attribute, return its value
            Return (CType(attributes(0), AssemblyProductAttribute)).Product
        End Get
    End Property

    ''' <summary>
    ''' Get Copyright from AssemblyInfo.cs
    ''' </summary>
    Public ReadOnly Property AssemblyCopyright() As String
        Get
            ' Get all Copyright attributes on this assembly
            Dim attributes() As Object = Assembly.GetExecutingAssembly().GetCustomAttributes(GetType(AssemblyCopyrightAttribute), False)
            ' If there aren't any Copyright attributes, return an empty string
            If attributes.Length = 0 Then
                Return ""
            End If
            ' If there is a Copyright attribute, return its value
            Return (CType(attributes(0), AssemblyCopyrightAttribute)).Copyright
        End Get
    End Property

    ''' <summary>
    ''' Get Company from AssemblyInfo.cs
    ''' </summary>
    Public ReadOnly Property AssemblyCompany() As String
        Get
            ' Get all Company attributes on this assembly
            Dim attributes() As Object = Assembly.GetExecutingAssembly().GetCustomAttributes(GetType(AssemblyCompanyAttribute), False)
            ' If there aren't any Company attributes, return an empty string
            If attributes.Length = 0 Then
                Return ""
            End If
            ' If there is a Company attribute, return its value
            Return (CType(attributes(0), AssemblyCompanyAttribute)).Company
        End Get
    End Property

#End Region

#Region " Get OS Up Time "

    Private Shared Function GetOSUptime() As String
        Dim intDays As Integer
        Dim intHours As Integer
        Dim intMinutes As Integer
        Dim intSeconds As Integer
        Dim intRemainder As Integer
        Dim intTicks As Integer
        Dim strDays As String
        Dim strHours As String
        Dim strMinutes As String
        Dim strSeconds As String

        ' initialize string variables
        strDays = ""
        strHours = ""
        strMinutes = ""
        strSeconds = ""

        Try
            Application.DoEvents()
            ' updates tick counter intTicks
            intTicks = System.Environment.TickCount

            ' there are  86400000 milliseconds in one day, compute whole days and get remainder
            Do
                intDays = Int(intTicks \ 86400000)
                intRemainder = intTicks Mod 86400000
            Loop Until intRemainder <= 86400000

            ' there are 3600000 milliseconds in one hour, compute whole hours and get remainder
            Do
                intHours = Int(intRemainder \ 3600000)
                intRemainder = intRemainder Mod 3600000
            Loop Until intRemainder <= 3600000

            ' there are 60000 milliseconds in one minute, compute whole minutes and get remainder
            Do
                intMinutes = Int(intRemainder \ 60000)
                intRemainder = intRemainder Mod 60000
            Loop Until intRemainder <= 60000

            ' there are 1000 milliseconds in one second, compute whole seconds and get remainder
            Do
                intSeconds = Int(intRemainder \ 1000)
                intRemainder = intRemainder Mod 1000
            Loop Until intRemainder <= 1000

            ' format days
            If intDays = 0 Then
                strDays = ""
            ElseIf Trim(CStr(intDays)).Length = 1 Then
                strDays = " " & Trim(CStr(intDays)) & ":"
            ElseIf Trim(CStr(intDays)).Length = 2 Then
                strDays = Trim(CStr(intDays)) & ":"
            End If

            ' format hours
            If intHours = 0 And intDays = 0 Then
                strHours = ""
            ElseIf Trim(CStr(intHours)).Length = 1 Then
                strHours = "0" & Trim(CStr(intHours)) & ":"
            ElseIf Trim(CStr(intHours)).Length = 2 Then
                strHours = Trim(CStr(intHours)) & ":"
            End If

            ' format minutes
            If intMinutes = 0 Then
                strMinutes = "00" & ":"
            ElseIf Trim(CStr(intMinutes)).Length = 1 Then
                strMinutes = "0" & Trim(CStr(intMinutes)) & ":"
            ElseIf Trim(CStr(intMinutes)).Length = 2 Then
                strMinutes = Trim(CStr(intMinutes)) & ":"
            End If

            ' format seconds
            If intSeconds = 0 Then
                strSeconds = "00"
            ElseIf Trim(CStr(intSeconds)).Length = 1 Then
                strSeconds = "0" & Trim(CStr(intSeconds))
            ElseIf Trim(CStr(intSeconds)).Length = 2 Then
                strSeconds = Trim(CStr(intSeconds))
            End If

            ' return time string
            Return strDays & strHours & strMinutes & strSeconds
        Catch ex As NullReferenceException
            Return ""
        Catch exc As ArithmeticException
            Return ""
        End Try

    End Function

#End Region

#Region " Timer Code "

    Private Sub tmrTickCount_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrTickCount.Tick
        ' updates status bar display
        lblDateTime.Text = FormatDateTime(Now, DateFormat.LongDate) & " " & _
            FormatDateTime(Now, DateFormat.LongTime)
        lblUpTime.Text = "Up Time: " & GetOSUptime()
    End Sub

#End Region

#Region " Button Events "

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        DialogResult = Windows.Forms.DialogResult.OK
    End Sub

    Private Sub btnOK_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnOK.MouseUp
        btnOK.FlatAppearance.BorderColor = Color.Black
    End Sub

    Private Sub btnOK_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnOK.MouseDown
        btnOK.FlatAppearance.BorderColor = Color.DodgerBlue
    End Sub

    Private Sub btnOK_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOK.MouseEnter
        btnOK.FlatAppearance.BorderColor = Color.DarkOrange
    End Sub

    Private Sub btnOK_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOK.MouseLeave
        btnOK.FlatAppearance.BorderColor = Color.Black
    End Sub

    Private Sub btnSysInfo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSysInfo.Click

        Try
            ' Now run msinfo32
            Dim startInfo As New ProcessStartInfo("msinfo32.exe")
            startInfo.WindowStyle = ProcessWindowStyle.Normal
            Process.Start(startInfo)
        Catch ex As FileNotFoundException
            ' cannot find file
            MessageBox.Show("Microsoft System Informtion cannot be found.", AssemblyTitle, _
                MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try

    End Sub

    Private Sub btnSysInfo_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnSysInfo.MouseUp
        btnSysInfo.FlatAppearance.BorderColor = Color.Black
    End Sub

    Private Sub btnSysInfo_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnSysInfo.MouseDown
        btnSysInfo.FlatAppearance.BorderColor = Color.DodgerBlue
    End Sub

    Private Sub btnSysInfo_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSysInfo.MouseEnter
        btnSysInfo.FlatAppearance.BorderColor = Color.DarkOrange
    End Sub

    Private Sub btnSysInfo_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSysInfo.MouseLeave
        btnSysInfo.FlatAppearance.BorderColor = Color.Black
    End Sub

#End Region

#Region " PictureBox Events "

    Private Sub picClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picClose.Click
        Me.DialogResult = Windows.Forms.DialogResult.OK
    End Sub

    Private Sub picClose_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles picClose.MouseEnter
        picClose.Image = My.Resources.Close_Mouse_Hover
    End Sub

    Private Sub picClose_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles picClose.MouseLeave
        picClose.Image = My.Resources.Close_Mouse_Up
    End Sub

#End Region

End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -