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

📄 volumeform.vb

📁 一个界面很好的iRadio收音机 一个界面很好的iRadio收音机
💻 VB
字号:
Option Explicit On
Option Strict On

''' <remarks>
''' Code for displaying form was converted from C# code from Code Project.
''' It was also modified for this project.
''' </remarks>
'''
''' <copyright>Copyright ?2006 Herbert N Swearengen III</copyright>
'''
''' <notice>
''' This application maybe freely distributed and modified as long
''' as the copyright notice and EULA are retained. This applies to
''' both the compiled application and it's source code.
''' </notice>
Public Class VolumeForm

#Region " Form-Level Variables "

    ''' <summary>
    ''' Screen working coordinates.
    ''' Varies with resolution setting and toolbar (TaskBar) size.
    ''' </summary>
    Private mScreenX As Integer = Screen.GetWorkingArea(Me).Width
    Private mScreenY As Integer = Screen.GetWorkingArea(Me).Height

#End Region

#Region " Form Events "

    ''' <summary>
    ''' Raise volume control form 25 pixels from the right-hand side of the screen.
    '''	When the mouse moves off of the form, lower the form.
    ''' </summary>
    Private Sub VolumeForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        ' Set color.
        SetColor(Me, Settings.Color)

        ' Set text on header.
        lblVolume.Text = My.Application.Info.Title & " 音量"

        ' Initial location of the form.
        Me.Location = New Point(mScreenX - Me.Width - 25, mScreenY + Me.Height)

        ' Set animation speed.
        tmrRaise.Interval = 25
        tmrLower.Interval = 25

        ' Raise the form.
        tmrRaise.Enabled = True
        tmrRaise.Start()

        ' Set volume.
        trkVolume.Value = Settings.Volume
        ToolTip1.SetToolTip(trkVolume, "音量 " & Settings.Volume.ToString & "%")

    End Sub

    Private Sub VolumeForm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
        ' Lower the form. 
        tmrLower.Enabled = True
        tmrLower.Start()
    End Sub

    Private Sub VolumeForm_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
        ' Lower the form. 
        tmrLower.Enabled = True
        tmrLower.Start()
    End Sub

#End Region

#Region " TrackBar Events "

    Private Sub trkVolume_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles trkVolume.Scroll
        Settings.Volume = trkVolume.Value
        MainForm.Player.settings.volume = Settings.Volume
        MainForm.ToolTip2.SetToolTip(MainForm.trkVolume, "音量 " & Settings.Volume.ToString & "%")
        ToolTip1.SetToolTip(trkVolume, "音量 " & Settings.Volume.ToString & "%")
    End Sub

#End Region

#Region " Button Events "

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        ' Lower the form. 
        tmrLower.Enabled = True
        tmrLower.Start()
    End Sub

    Private Sub btnClose_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnClose.MouseDown
        btnClose.FlatAppearance.BorderColor = Color.DarkOrange
    End Sub

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

    Private Sub btnClose_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClose.MouseEnter
        btnClose.FlatAppearance.BorderColor = Color.DodgerBlue
    End Sub

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

    Private Sub btnMute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMute.Click
        MainForm.Mute()
    End Sub

    Private Sub btnMute_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnMute.MouseDown
        btnMute.FlatAppearance.BorderColor = Color.DarkOrange
    End Sub

    Private Sub btnMute_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnMute.MouseEnter
        btnMute.FlatAppearance.BorderColor = Color.DodgerBlue
    End Sub

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

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

#End Region

#Region " Raise the Form "

    ''' <summary>
    ''' Open the form below the taskbar and then
    '''	gradually bring the form above taskbar.
    ''' </summary>
    Private Sub tmrRaise_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrRaise.Tick

        ' Find the form's Y-axis location.
        Dim i As Integer = Me.Location.Y

        ' This is the upper limit for form's location.
        If (i > mScreenY - Me.Height) Then

            ' Change the location of the form by 8 pixels(i-8).
            Me.Location = New Point(mScreenX - Me.Width - 25, i - 8)

        Else
            ' Stop tmrRaise.
            tmrRaise.Stop()
            tmrRaise.Enabled = False

        End If

    End Sub

#End Region

#Region " Lower the Form "

    ''' <summary>
    ''' This is the same as opening the form, only location value of Y-axis
    ''' is increased, so that form slowly hides behind Task Bar.
    ''' </summary>
    Private Sub tmrLower_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmrLower.Tick

        ' Find the form's Y-axis location.
        Dim i As Integer = Me.Location.Y

        If i < mScreenY Then

            ' Change the location of the form by 8 pixels(i+8).
            Me.Location = New Point(mScreenX - Me.Width - 25, i + 8)

        Else

            ' Stop tmrLower.
            tmrLower.Stop()
            tmrLower.Enabled = False

            DialogResult = Windows.Forms.DialogResult.OK
        End If

    End Sub

#End Region

End Class

⌨️ 快捷键说明

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