Guest User

[VB.NET] Chapitre 7 - classe Main

a guest
Feb 10th, 2016
17
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports Transitions
  2. Imports Launcher.LauncherMethods
  3.  
  4. Public Class Main
  5.  
  6. #Region " Méthodes "
  7.  
  8.  
  9.     ' -------------------------------------------------------------------------------------
  10.     ' ----- [ FORMULAIRE ] ----------------------------------------------------------------
  11.     ' -------------------------------------------------------------------------------------
  12.  
  13.     Private Sub Initialize()
  14.         Try
  15.             ' Prévention des scintillements
  16.             Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
  17.  
  18.             ' Affichage en fondu
  19.             LauncherMethods.FadeWindow(Me, FadeAction.Show, FadeTime.Fast)
  20.  
  21.             ' Modification de la control box
  22.             Me.PNL_TOP.Font = FontManager.GetFont(My.Resources.MaterialIcons_Regular, 15)
  23.             Me.LBL_CLOSE.Font = PNL_TOP.Font
  24.             Me.LBL_CLOSE.Text = ChrW(&HE5CD)
  25.             Me.LBL_REDUCE.Font = PNL_TOP.Font
  26.             Me.LBL_REDUCE.Text = ChrW(&HE5CF)
  27.  
  28.         Catch ex As Exception
  29.             Logger.Exception(ex)
  30.         End Try
  31.     End Sub
  32.  
  33.  
  34. #End Region
  35.  
  36. #Region " Évenements "
  37.  
  38.  
  39.     ' -------------------------------------------------------------------------------------
  40.     ' ----- [ FORMULAIRE ] ----------------------------------------------------------------
  41.     ' -------------------------------------------------------------------------------------
  42.  
  43.  
  44.     ''' <summary>
  45.     ''' Se déclenche lorsque la fenêtre s'ouvre.
  46.     ''' </summary>
  47.     Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  48.         Me.Initialize()
  49.     End Sub
  50.  
  51.     ''' <summary>
  52.     ''' Se déclenche lorsque la fenêtre se ferme.
  53.     ''' </summary>
  54.     Private Sub Main_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
  55.         LauncherMethods.FadeWindow(Me, FadeAction.Hide, FadeTime.Fast)
  56.         Environment.Exit(0)
  57.     End Sub
  58.  
  59.  
  60.  
  61.  
  62.     ' -------------------------------------------------------------------------------------
  63.     ' ----- [ CONTROL BOX ] ---------------------------------------------------------------
  64.     ' -------------------------------------------------------------------------------------
  65.  
  66.  
  67.     ''' <summary>
  68.     ''' Se déclenche lorsque la souris entre sur le bouton de fermeture.
  69.     ''' </summary>
  70.     Private Sub LBL_CLOSE_MouseEnter(sender As Object, e As EventArgs) Handles LBL_CLOSE.MouseEnter
  71.         Transition.run(LBL_CLOSE, "ForeColor", ColorTranslator.FromHtml("#e57373"), New TransitionType_Linear(250))
  72.         Transition.run(LBL_CLOSE, "BackColor", Color.FromArgb(100, 0, 0, 0), New TransitionType_Linear(250))
  73.     End Sub
  74.     Private Sub LBL_CLOSE_MouseLeave(sender As Object, e As EventArgs) Handles LBL_CLOSE.MouseLeave
  75.         Transition.run(LBL_CLOSE, "ForeColor", ColorTranslator.FromHtml("#ecf0f1"), New TransitionType_Linear(250))
  76.         Transition.run(LBL_CLOSE, "BackColor", Color.FromArgb(0, 0, 0, 0), New TransitionType_Linear(250))
  77.     End Sub
  78.  
  79.  
  80.     ''' <summary>
  81.     ''' Se déclenche lorsque l'utilisateur clique sur le bouton de fermeture.
  82.     ''' </summary>
  83.     Private Sub LBL_CLOSE_Click(sender As Object, e As EventArgs) Handles LBL_CLOSE.Click
  84.         Me.Close()
  85.     End Sub
  86.  
  87.     ''' <summary>
  88.     ''' Se déclenche lorsque la souris entre sur le bouton de réduction.
  89.     ''' </summary>
  90.     Private Sub LBL_REDUCE_MouseEnter(sender As Object, e As EventArgs) Handles LBL_REDUCE.MouseEnter
  91.         Transition.run(LBL_REDUCE, "ForeColor", ColorTranslator.FromHtml("#4fc3f7"), New TransitionType_Linear(250))
  92.         Transition.run(LBL_REDUCE, "BackColor", Color.FromArgb(100, 0, 0, 0), New TransitionType_Linear(250))
  93.     End Sub
  94.     Private Sub LBL_REDUCE_MouseLeave(sender As Object, e As EventArgs) Handles LBL_REDUCE.MouseLeave
  95.         Transition.run(LBL_REDUCE, "ForeColor", ColorTranslator.FromHtml("#ecf0f1"), New TransitionType_Linear(250))
  96.         Transition.run(LBL_REDUCE, "BackColor", Color.FromArgb(0, 0, 0, 0), New TransitionType_Linear(250))
  97.     End Sub
  98.  
  99.  
  100.     ''' <summary>
  101.     ''' Se déclenche lorsque l'utilisateur clique sur le bouton de réduction.
  102.     ''' </summary>
  103.     Private Sub LBL_REDUCE_Click(sender As Object, e As EventArgs) Handles LBL_REDUCE.Click
  104.         Me.WindowState = FormWindowState.Minimized
  105.     End Sub
  106.  
  107. #End Region
  108.  
  109.  
  110.  
  111. End Class
RAW Paste Data