Public Class Form1
    Dim строка As Integer = -1 ' Объявляем номера строк в ListBox1 и присваеваем ему отрицательное значение
    Dim URL As String 'Переменная где будет храниться ссылка для радио
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Height = 469 'Размеры формы при старте
        Me.Width = 308 'Размеры формы при старте
        TrackBar1.Value = 0 'Начальная громкость
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

    End Sub

    Private Sub PictureBox2_Click(sender As Object, e As EventArgs) Handles PictureBox2.Click
        ' Пункт меню Вкл.Звук
        AxWindowsMediaPlayer1.settings.mute = False
        PictureBox2.Visible = False 'Меняем кнопки местами
        PictureBox9.Visible = True 'Меняем кнопки местами
    End Sub

    Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged

        строка = ListBox1.SelectedIndex + 1 'Номер строки в Названия_радио
        'Считываем URL радио станции с текстового документа.
        Dim Чтение As New System.IO.StreamReader("База\URL.txt")
        Dim i As Integer
        For i = 1 To строка
            URL = Чтение.ReadLine
        Next
        Чтение.Close()
        AxWindowsMediaPlayer1.URL = URL 'Запускаем радио поток
        PictureBox8.Image = Image.FromFile("База\" & (строка - 1) & ".jpg") 'Загружаем логотип радио станции
    End Sub

    Private Sub PictureBox3_Click(sender As Object, e As EventArgs) Handles PictureBox3.Click
        AxWindowsMediaPlayer1.Ctlcontrols.play()
    End Sub

    Private Sub PictureBox4_Click(sender As Object, e As EventArgs) Handles PictureBox4.Click
        AxWindowsMediaPlayer1.Ctlcontrols.pause()
    End Sub

    Private Sub PictureBox5_Click(sender As Object, e As EventArgs) Handles PictureBox5.Click
        AxWindowsMediaPlayer1.Ctlcontrols.stop()
        
    End Sub
    Private Sub AxWindowsMediaPlayer1_Enter(sender As Object, e As EventArgs) Handles AxWindowsMediaPlayer1.Enter

    End Sub

    Private Sub PictureBox7_Click(sender As Object, e As EventArgs) Handles PictureBox7.Click
        Me.Height = 155 'Полная длина окна формы
        PictureBox6.Visible = True 'Меняем кнопки местами
        PictureBox7.Visible = False 'Меняем кнопки местами
    End Sub

    Private Sub PictureBox6_Click(sender As Object, e As EventArgs) Handles PictureBox6.Click
        Me.Height = 469 'Свернутая длина окна формы
        PictureBox7.Visible = True 'Меняем кнопки местами
        PictureBox6.Visible = False 'Меняем кнопки местами
    End Sub

    Private Sub PictureBox8_Click(sender As Object, e As EventArgs) Handles PictureBox8.Click

    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
        Label1.Text = "0 %"
    End Sub

    Private Sub PictureBox9_Click(sender As Object, e As EventArgs) Handles PictureBox9.Click
        ' Пункт меню Выкл.Звук
        AxWindowsMediaPlayer1.settings.mute = True
        PictureBox9.Visible = False 'Меняем кнопки местами
        PictureBox2.Visible = True 'Меняем кнопки местами
    End Sub

    Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
        NotifyIcon1.Visible = True
        Me.Hide()
    End Sub

    Private Sub NotifyIcon1_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
        Me.Show()
        NotifyIcon1.Visible = False
    End Sub

    Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll
        ' установка уровня звука
        Me.AxWindowsMediaPlayer1.settings.volume = TrackBar1.Value
        Me.Label1.Text = Math.Round(TrackBar1.Value / (TrackBar1.Maximum - TrackBar1.Minimum) * 100 + 0, 1) & "%"
    End Sub
End Class


