' Copyright (C) 2025  P4pillon.org
'
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU Affero General Public License as
' published by the Free Software Foundation, either version 3 of the
' License, or (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU Affero General Public License for more details.
'
' You should have received a copy of the GNU Affero General Public License
' along with this program.  If not, see <https://www.gnu.org/licenses/>.
Public Class Bandeau_info_bas2

    Private Sub Bandeau_info_bas2_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
        While Me.Width > 60

            Me.Width = Me.Width - 60
            Me.Location = New Point((Screen.PrimaryScreen.Bounds.Width - Me.Width) / 2, Me.Location.Y)
            round()
            Application.DoEvents()
            System.Threading.Thread.Sleep(5)
        End While
  
    End Sub



    Private Sub Bandeau_info_bas2_Load(sender As Object, e As EventArgs) Handles Me.Load
        Try

            Dim data = Mes_Couleurs.ColorsTableAdapter.GetData_bandeau_info_bas(current_User.ID)
            For r = 0 To data.Rows.Count - 1
                If data(r).Color_Item = "Bandeau_Info_bas" Then
                    Me.BackColor = Color.FromName(data(r).Color_Name)
                    Label1.BackColor = Color.FromName(data(r).Color_Name)
                ElseIf data(r).Color_Item = "Bandeau_Info_bas_label" Then
                    Label1.ForeColor = Color.FromName(data(r).Color_Name)
                End If
            Next
        Catch ex As Exception
        End Try
        
        Me.TopMost = True
        Me.BringToFront()
        For y = 0 To 130 Step 10
            Me.Size = New Size(Screen.PrimaryScreen.Bounds.Width - 200, y)
            Me.Location = New Point(100, Screen.PrimaryScreen.Bounds.Height - y)
            round()
            Application.DoEvents()
            System.Threading.Thread.Sleep(5)
        Next

        For y = 140 To 200 Step 10
            Me.Location = New Point(100, Screen.PrimaryScreen.Bounds.Height - y)
            round()
            Application.DoEvents()
            System.Threading.Thread.Sleep(5)
        Next
        Me.Update()

  

    End Sub
    Private Sub round()
        Me.FormBorderStyle = FormBorderStyle.None
        'Me.Height = 300
        'Me.Width = 400
        Dim p As New Drawing2D.GraphicsPath()
        p.StartFigure()
        p.AddArc(New Rectangle(0, 0, 40, 40), 180, 90)
        p.AddLine(40, 0, Me.Width - 40, 0)
        p.AddArc(New Rectangle(Me.Width - 40, 0, 40, 40), -90, 90)
        p.AddLine(Me.Width, 40, Me.Width, Me.Height - 40)
        p.AddArc(New Rectangle(Me.Width - 40, Me.Height - 40, 40, 40), 0, 90)
        p.AddLine(Me.Width - 40, Me.Height, 40, Me.Height)
        p.AddArc(New Rectangle(0, Me.Height - 40, 40, 40), 90, 90)
        p.CloseFigure()
        Me.Region = New Region(p)
        'Me.BackColor = Color.Red
    End Sub

    Public Sub Change_text(ByVal texte As String)
        Label1.Text = texte
        Application.DoEvents()
    End Sub
End Class